-
Notifications
You must be signed in to change notification settings - Fork 0
/
filetree
executable file
·50 lines (42 loc) · 1.75 KB
/
filetree
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
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env node
var filetree = require('./filetree.js'),
cwd = process.cwd(),
argv = require('yargs').
usage("$0 \t[-p <target path>]\n\t[-m <max recursion depth>]\n\t[-x <excluded names>]\n\t[-a]\n\t[-i]").
default('path', cwd, cwd).
describe('path', 'Print contents of directory at this path (relative or absolute)').
string('path').
alias('path', 'p').
default('max-depth', -1, 'Unlimited').
describe('max-depth', 'Maximum directory recursion depth').
alias('max-depth', 'm').
example('filetree -m 0', 'Only print root directory').
example('filetree -m 2', 'Print root and the two lower levels of directories').
array('exclude').
describe('exclude', 'Exclude file and folder names').
alias('exclude', 'x').
default('exclude', []).
example('filetree -x build tmp test', 'Exclude multiple folder names').
boolean('all').
describe('all', 'Include files and folders beginning with a period').
alias('all', 'a').
default('all', false).
example('filetree -p myGitProject -a', 'Includes .git which is normally ignored').
boolean('indent').
describe('indent', 'Indent paths based on their depth level').
alias('indent', 'i').
default('indent', true).
example('filetree --no-indent', 'Prevent the default indentation').
version(require('./package').version).
alias('version', 'V').
alias('help', 'h').
help('help').
epilogue('Report bugs at https://github.com/aiham/filetree.js/issues').
argv;
filetree({
path: argv.path,
maxDepth: argv.maxDepth,
exclude: argv.exclude,
all: argv.all,
indent: argv.indent
});