Skip to content

Commit 238941a

Browse files
committed
chore(docs): improve docs added badge
1 parent f9a033e commit 238941a

File tree

1 file changed

+50
-51
lines changed

1 file changed

+50
-51
lines changed

README.md

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Systemd.js
22

3+
![Publish](https://github.com/systemd-js/systemd/actions/workflows/publish.yaml/badge.svg)
4+
35
Collection of packages useful when interfacing with systemd.
46

57
## @systemd-js/conf
@@ -19,7 +21,8 @@ yarn add @systemd-js/conf
1921

2022
Parse systemd ini file into object.
2123

22-
Note: Ini parser is not fully implemented, lacks support for escaping and quoting.
24+
Note: Ini parser is not fully implemented, lacks support for escaping and
25+
quoting.
2326

2427
```ts
2528
import {INI} from "@systemd-js/conf";
@@ -64,7 +67,6 @@ const ini = INI.fromString(unit).toObject();
6467
User: "root",
6568
},
6669
};
67-
6870
```
6971

7072
Create service unit for ini string and modify service user definition.
@@ -88,46 +90,46 @@ PrivateTmp=yes
8890
User=root
8991
`;
9092

91-
const ini = INI.fromString(unit)
92-
const service = Service.fromINI(ini)
93+
const ini = INI.fromString(unit);
94+
const service = Service.fromINI(ini);
9395

9496
service
9597
.getServiceSection()
96-
.setUser("test")
98+
.setUser("test");
9799

98100
service.toINIString();
99101
```
100102

101103
Create service unit using fluent builder
102104

103105
```ts
104-
import {Service} from "@systemd-js/config";
106+
import { Service } from "@systemd-js/config";
105107

106108
const service = new Service();
107109

108110
service
109111
.getUnitSection()
110-
.setDescription("This is a example unit")
112+
.setDescription("This is a example unit");
111113

112114
service
113115
.getInstallSection()
114-
.setWantedBy("multi-user.target")
115-
116+
.setWantedBy("multi-user.target");
117+
116118
service
117-
.getServiceSection()
118-
.setType("simple")
119-
.setWorkingDirectory("/tmp")
120-
.setRestart("always")
121-
.setExecStartPre("/usr/bin/echo 'Before'")
122-
.setExecStart("/usr/bin/echo 'Hello World'")
123-
.setExecStartPost("/usr/bin/echo 'After'")
119+
.getServiceSection()
120+
.setType("simple")
121+
.setWorkingDirectory("/tmp")
122+
.setRestart("always")
123+
.setExecStartPre("/usr/bin/echo 'Before'")
124+
.setExecStart("/usr/bin/echo 'Hello World'")
125+
.setExecStartPost("/usr/bin/echo 'After'");
124126
```
125127

126128
Create timer unit using fluent builder
127129

128130
```ts
129-
import {Timer} from "@systemd-js/config";
130-
const timer = new Timer()
131+
import { Timer } from "@systemd-js/config";
132+
const timer = new Timer();
131133

132134
timer
133135
.getUnitSection()
@@ -136,7 +138,7 @@ timer
136138

137139
timer
138140
.getInstallSection()
139-
.setWantedBy("multi-user.target");
141+
.setWantedBy("multi-user.target");
140142

141143
timer
142144
.getTimerSection()
@@ -146,8 +148,8 @@ timer
146148

147149
## @systemd-js/ctl
148150

149-
Control over units. Interface to systemctl.
150-
At the moment this lack proper error handling.
151+
Control over units. Interface to systemctl. At the moment this lack proper error
152+
handling.
151153

152154
### Installation
153155

@@ -160,57 +162,54 @@ yarn add @systemd-js/ctl
160162
State manipulation of existing service.
161163

162164
```ts
163-
import {Ctl} from "@systemd-js/ctl";
164-
165-
const ctl = new Ctl("test.service")
165+
import { Ctl } from "@systemd-js/ctl";
166166

167-
ctl.disable()
168-
ctl.enable()
169-
ctl.stop()
170-
ctl.start()
171-
ctl.restart()
167+
const ctl = new Ctl("test.service");
172168

169+
ctl.disable();
170+
ctl.enable();
171+
ctl.stop();
172+
ctl.start();
173+
ctl.restart();
173174
```
174175

175176
Creation of new service "example.service"
176177

177178
```ts
178-
import {Service} from "@systemd-js/config";
179-
import {Ctl} from "@systemd-js/ctl";
179+
import { Service } from "@systemd-js/config";
180+
import { Ctl } from "@systemd-js/ctl";
180181

181182
const service = new Service();
182183

183184
service
184185
.getUnitSection()
185-
.setDescription("This is a example unit")
186+
.setDescription("This is a example unit");
186187

187188
service
188189
.getInstallSection()
189-
.setWantedBy("multi-user.target")
190-
191-
service
192-
.getServiceSection()
193-
.setType("simple")
194-
.setExecStart("/usr/bin/echo 'Hello World'")
190+
.setWantedBy("multi-user.target");
195191

196-
const ctl = new Ctl("example", service)
192+
service
193+
.getServiceSection()
194+
.setType("simple")
195+
.setExecStart("/usr/bin/echo 'Hello World'");
197196

198-
ctl.create()
199-
ctl.enable()
200-
ctl.start()
197+
const ctl = new Ctl("example", service);
201198

199+
ctl.create();
200+
ctl.enable();
201+
ctl.start();
202202
```
203203

204204
In addition to `Ctl` class, package expose functions to call systemctl directly.
205205

206206
```ts
207-
import {restart, start, stop} from "@systemd-js/ctl";
208-
209-
stop("example.service")
210-
start("example.service")
211-
enable("example.service")
212-
disable("example.service")
213-
reload("example.service")
214-
restart("example.service")
215-
207+
import { restart, start, stop } from "@systemd-js/ctl";
208+
209+
stop("example.service");
210+
start("example.service");
211+
enable("example.service");
212+
disable("example.service");
213+
reload("example.service");
214+
restart("example.service");
216215
```

0 commit comments

Comments
 (0)