-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcli.js
More file actions
21 lines (17 loc) · 584 Bytes
/
cli.js
File metadata and controls
21 lines (17 loc) · 584 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env node
import help from './lib/help.js';
import { anallify, stringify } from './lib/stdlib.js';
import { HELP, STRINGIFY, ANALLIFY } from './lib/constants.js';
function cli() {
let output = '';
const command = process.argv[2];
const args = process.argv.slice(3, process.argv.length).join('');
switch (command) {
case HELP: process.stdout.write(help); break;
case ANALLIFY: output = anallify(args); break;
case STRINGIFY: output = stringify(args); break;
default: process.stdout.write(help); break;
}
process.stdout.write(output);
}
cli();