-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·40 lines (32 loc) · 704 Bytes
/
cli.js
File metadata and controls
executable file
·40 lines (32 loc) · 704 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
34
35
36
37
38
39
40
#!/usr/bin/env node
import process from 'node:process';
import meow from 'meow';
import {makeDirectorySync} from 'make-dir';
const cli = meow(`
Usage
$ make-dir <directory> …
Options
--mode Directory permissions
Examples
$ make-dir unicorn/awesome foo/bar
$ make-dir rainbow --mode=0666
`, {
importMeta: import.meta,
flags: {
mode: {
type: 'string',
},
},
});
const {input: directories} = cli;
if (directories.length === 0) {
console.error('Specify at least one path');
process.exit(1);
}
const options = {};
if (cli.flags.mode) {
options.mode = Number.parseInt(cli.flags.mode, 8);
}
for (const directory of directories) {
makeDirectorySync(directory, options);
}