Skip to content

Commit

Permalink
docs: update help desc and examples
Browse files Browse the repository at this point in the history
w2xi committed Jan 31, 2024
1 parent ca1691e commit 7c2e85e
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -20,18 +20,20 @@ Generate a directory structure tree

Options:
-V, --version output the version number
-i, --ignore <ig> ignore specific directory name
-i, --ignore <ig> ignore specific directory name, separated by comma or '|'
-d, --depth <depth> specify the depth of output
-f, --only-folder output folder only
--icon output emoji icon, prefixing filename or directory
-o, --output <output> export content into a file
-o, --output <output> export content into a file, appending mode by default
-h, --help display help for command
```

## Examples

Ignore `.git` and `node_modules` directory

```bash
$ treei -i '.git,node_modules'
$ treei -i '.git,node_modules' # or treei -i'git|node_modules'
treei
├──.gitignore
├──package-lock.json
@@ -41,6 +43,8 @@ treei
| └──index.js
```

Show emoji icon, prefixing filename or directory

```bash
$ treei -i '.git,node_modules' --icon
treei
@@ -52,6 +56,8 @@ treei
| └──📄index.js
```

Export output into result.md, and append mode by default.

```bash
$ treei -i '.git,node_modules' -o result.md
treei
@@ -61,6 +67,4 @@ treei
├──README.md
└──src
| └──index.js

# The output has been saved into ./result.md
```
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -19,11 +19,11 @@ program
.name('treei')
.version(package.version)
.description('Generate a directory structure tree')
.option('-i, --ignore <ig>', 'ignore specific directory name')
.option('-i, --ignore <ig>', 'ignore specific directory name, separated by comma or \'|\'')
.option('-d, --depth <depth>', 'specify the depth of output')
.option('-f, --only-folder', 'output folder only')
.option('--icon', 'output emoji icon, prefixing filename or directory')
.option('-o, --output <output>', 'export content into a file')
.option('-o, --output <output>', 'export content into a file, appending mode by default')
.parse(process.argv)

const options = program.opts()

0 comments on commit 7c2e85e

Please sign in to comment.