-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·33 lines (26 loc) · 789 Bytes
/
cli.js
File metadata and controls
executable file
·33 lines (26 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env node
import { resolve } from 'path';
import { Command } from 'commander';
import getHandlers from './index.js';
import pojoStick from 'pojo-stick';
import { readFile } from 'fs/promises';
const pkg = JSON.parse(
await readFile(new URL('./package.json', import.meta.url))
);
;(async () => {
// persistent appData
const appData = await pojoStick(resolve('.', '.data-store.json'))
const { test } = getHandlers({ appData })
const program = new Command();
program
.version(pkg.version)
.description('__REPLACE_DESCRIPTION_WITH_MAKE_CMD__')
.option('-d, --debug', 'enable debug mode')
;
program
.command('test <action> [type] [rest...]')
.description('Test out the CLI API')
.action(test)
;
program.parse(process.argv);
})()