@@ -20,7 +20,8 @@ program
2020 . version ( package . version )
2121 . description ( 'Generate a directory structure tree' )
2222 . option ( '-i, --ignore <ig>' , 'ignore specific directory name, separated by comma or \'|\'' )
23- . option ( '-d, --depth <depth>' , 'specify the depth of output' )
23+ . option ( '-l, --level <level>' , 'specify the level of output' )
24+ . option ( '-d, --directory <dir>' , 'specify the directory to generate structure tree' , process . cwd ( ) )
2425 . option ( '-f, --only-folder' , 'output folder only' )
2526 . option ( '--icon' , 'output emoji icon, prefixing filename or directory' )
2627 . option ( '-o, --output <output>' , 'export content into a file, appending mode by default' )
@@ -67,15 +68,15 @@ function toTree(path, deep = 0) {
6768 }
6869}
6970
70- const root = toTree ( process . cwd ( ) )
71+ const root = toTree ( options . directory )
7172
72- let depth
73- if ( options . depth && ! Number . isNaN ( parseInt ( options . depth ) ) ) {
74- depth = parseInt ( options . depth )
73+ let level
74+ if ( options . level && ! Number . isNaN ( parseInt ( options . level ) ) ) {
75+ level = parseInt ( options . level )
7576}
7677
7778function isReachedDepth ( deep ) {
78- return typeof depth === 'number' && deep >= depth
79+ return typeof level === 'number' && deep >= level
7980}
8081
8182let output = ''
0 commit comments