Total Pageviews

Tuesday 16 June 2020

tree-node-cli


Lists the contents of directories in a tree-like format, similar to the Linux tree command. Both CLI and Node APIs are provided.
Tree is a recursive directory listing program that produces a depth indented listing of files. When a directory argument is given, tree lists all the files and/or directories found in the given directory.
Note: Symlinks are not followed.

Installation

$ npm install tree-node-cli
# or globally
$ npm install -g tree-node-cli

Example

$ tree -L 2 -I "node_modules"
tree-node-cli
├── LICENSE
├── README.md
├── __tests__
│   ├── __fixtures__
│   ├── __snapshots__
│   ├── fixtures
│   └── tree.test.js
├── bin
│   └── tree
├── jest.config.js
├── package.json
├── tree.js
└── yarn.lock

CLI

$ tree [options] [path/to/dir]
Note: Use the command treee on Windows and Linux to avoid conflicts with built-in tree command.
The following options are available:
$ tree -h

  Usage: tree [options]

  Options:

    -V, --version             output the version number
    -a, --all-files           All files, include hidden files, are printed.
    --dirs-first              List directories before files.
    -d, --dirs-only           List directories only.
    -I, --exclude [patterns]  Exclude files that match the pattern. | separates alternate patterns. Wrap your entire pattern in double quotes. E.g. `"node_modules|coverage".
    -L, --max-depth        Max display depth of the directory tree.
    -r, --reverse             Sort the output in reverse alphabetic order.
    -F, --trailing-slash      Append a '/' for directories.
    -h, --help                output usage information
from https://github.com/yangshun/tree-node-cli

No comments:

Post a Comment