Skip to content

Commit

Permalink
Add README.md with simple code example
Browse files Browse the repository at this point in the history
  • Loading branch information
xtremekforever committed Dec 22, 2023
1 parent 3d3a550 commit 783490f
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Systemd

A simple Swift library to interface with systemd on Linux.

## Installation

Add the following dependency to your `Package.swift` file:

```swift
.package(url: "https://github.com/xtremekforever/swift-systemd.git", from: "0.0.1")
```

Then, add it to your target `dependencies` section like this:

```swift
.product(name: "Systemd", package: "swift-systemd")
```

## Usage

For now, the library only has the ability to see if the app is running under systemd. To do this,
`import Systemd` in your app, then use `SystemdHelpers` to get a true or false value:

```swift
if SystemdHelpers.isSystemdService {
print("This app is running as a systemd service!")

// do things like modify logging format (if using swift-log) or whatever else is needed.
}
```

0 comments on commit 783490f

Please sign in to comment.