Skip to content

Commit 130b36b

Browse files
style: formatting of some files
Side effect of running NPM run format. Just removes some white space at the end of each line that I seemed to have forgotten.
1 parent cef7f04 commit 130b36b

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

src/cli.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import net from "net";
1616
*/
1717
export function mergeArgsAndExec(command: Command, func: Function) {
1818
const options = {
19-
...(command.parent!.opts()),
20-
...(command.opts()),
19+
...command.parent!.opts(),
20+
...command.opts(),
2121
};
2222

2323
const resolvedLogLevel =
@@ -162,9 +162,10 @@ export const serve = program
162162
/* Adding the 'host' option to the serve command */ {
163163
serve.option(
164164
"-H, --host <ip-address>",
165-
"The host to use ports from.",
165+
"The host to use ports from.",
166166
(value) => {
167-
if (!net.isIP(value)) throw new Error(`${value} is not a valid IP address`);
167+
if (!net.isIP(value))
168+
throw new Error(`${value} is not a valid IP address`);
168169
else return value;
169170
},
170171
ServeArgs.defaults.host,
@@ -173,8 +174,8 @@ export const serve = program
173174

174175
/* Adding the 'port' option to the serve command */ {
175176
serve.option(
176-
"-p, --port <int>",
177-
"The port to listen on and serve the slides from.",
177+
"-p, --port <int>",
178+
"The port to listen on and serve the slides from.",
178179
(value) => Number(value),
179180
ServeArgs.defaults.port,
180181
);
@@ -184,7 +185,7 @@ export const serve = program
184185
serve.option(
185186
"-r, --root <prefix>",
186187
"The root prefix the serve on. If specified serve from that subdirectory.",
187-
(value) => {
188+
(value) => {
188189
if (value.startsWith("/")) return value;
189190
else throw new Error(`root paths must start with '/', but got ${value}`);
190191
},
@@ -194,7 +195,8 @@ export const serve = program
194195

195196
/* Try parsing the arguments */ {
196197
if (import.meta.url === `file://${process.argv[1]}`) {
197-
try { // being run as main file, not imported.
198+
try {
199+
// being run as main file, not imported.
198200
program.parse(process.argv, { from: "node" });
199201
} catch (error: any) {
200202
if (error.code === "commander.unknownOption") process.exit(3);

test/src/cli.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { program, compile, serve } from '#src/cli';
1+
import { program, compile, serve } from "#src/cli";
22
import { describe, test, expect } from "vitest";
3-
import { Command } from 'commander';
3+
import { Command } from "commander";
44

55
describe("program", () => {
66
// tests relating `program`:
@@ -12,7 +12,7 @@ describe("program", () => {
1212

1313
describe("compile", () => {
1414
// tests relating `compile`:
15-
15+
1616
test("to be subcommand of program", () => {
1717
expect(compile).toBeInstanceOf(Command);
1818
expect(compile.parent).toBe(program);
@@ -21,7 +21,7 @@ describe("compile", () => {
2121

2222
describe("serve", () => {
2323
// tests relating `serve`:
24-
24+
2525
test("to be subcommand of program", () => {
2626
expect(serve).toBeInstanceOf(Command);
2727
expect(serve.parent).toBe(program);

0 commit comments

Comments
 (0)