{"id":15067304,"url":"https://github.com/mrraindrop/tree-cli","last_synced_at":"2025-04-04T07:08:51.620Z","repository":{"id":19436112,"uuid":"22679770","full_name":"MrRaindrop/tree-cli","owner":"MrRaindrop","description":"🌴List contents of directories in tree-like format.","archived":false,"fork":false,"pushed_at":"2022-12-30T18:53:14.000Z","size":468,"stargazers_count":265,"open_issues_count":12,"forks_count":24,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-04T07:08:48.171Z","etag":null,"topics":["cli-tree","file-structure","tree","tree-cli","tree-cmd","treelist"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MrRaindrop.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-06T11:09:58.000Z","updated_at":"2025-03-09T19:31:11.000Z","dependencies_parsed_at":"2023-01-13T20:22:14.825Z","dependency_job_id":null,"html_url":"https://github.com/MrRaindrop/tree-cli","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrRaindrop%2Ftree-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrRaindrop%2Ftree-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrRaindrop%2Ftree-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrRaindrop%2Ftree-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MrRaindrop","download_url":"https://codeload.github.com/MrRaindrop/tree-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247135144,"owners_count":20889421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli-tree","file-structure","tree","tree-cli","tree-cmd","treelist"],"created_at":"2024-09-25T01:19:25.183Z","updated_at":"2025-04-04T07:08:51.594Z","avatar_url":"https://github.com/MrRaindrop.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tree-cli\n\n[![CircleCI](https://circleci.com/gh/MrRaindrop/tree-cli.svg?style=svg)](https://circleci.com/gh/MrRaindrop/tree-cli)\n[![npm version](https://badge.fury.io/js/tree-cli.svg)](https://badge.fury.io/js/tree-cli)\n![downloads](https://img.shields.io/npm/dm/tree-cli?style=flat-square)\n\nList contents of directories in tree-like format.\n\nTree-cli is a recursive directory listing program that produces a depth indented listing of files. With no arguments, tree lists the files in the current directory. When directory arguments are given, tree lists all the files and/or directories found in the given directories each in turn. Upon completion of listing all files/directories found, tree returns the total number of files and/or directories listed.\n\n## example\n\ncmd:\n\n```\ntree -l 2 -o output.txt\n```\n\nresult:\n\n```\n/Applications/XAMPP/htdocs/node_playground/tree-cli\n├── README.md\n├── bin\n|  └── tree\n├── node_modules\n|  ├── bluebird\n|  ├── chalk\n|  ├── cli-spinner\n|  ├── meow\n|  └── object-assign\n├── package.json\n└── tree.js\n\ndirectory: 7 file: 4\n```\n\n## install\n\n```\nnpm install -g tree-cli\n```\n\n## usage\n\n#### Use the command `tree` or `treee` (to avoid confliction with system command).\n\n**NOTE: use `treee` instead of `tree` on windows system.**\n\n``\ntree/treee\n``\n\n#### Use it as a node module to get the detailed tree data.\n\n```javascript\nrequire('tree-cli')({\n  base: '.',    // or any path you want to inspect.\n  noreport: true\n}).then(res =\u003e {\n  // res.data is the data for the file tree.\n  // res.report is the stringified scanning report.\n  console.log(res.data, res.report);\n});\n```\n\nYou can find the type declaration for the exporting function and the type declaration of its' params and result in the 'types/index.d.ts' file. If you are using VSCode, you'll find the type hint during your typing.\n\n**Breaking change:** In version before 0.6.0, the resovled result is the tree structure of the scanned directory. But in latest **v0.6.0**, the resolved result is changed to a object contains both the file tree structure and the scanned report. The structure of result would be:\n\n```\n{\n  data: {\n    // ...The file node tree.\n  },\n  report: '...',  // The final report.\n}\n```\n\n#### use --help to list help info.\n\n``\ntree --help\n``\n\n#### specify the level of path (how deep to scan).\n\nuse `-l levelNumber` to specify the path level.\n\n```\ntree -l 2\n```\n\n#### output result to a file\n\nuse `-o outputFilePath` to specify the output file.\n\n```\ntree -l 2 -o out.txt\n```\n\n#### show directory only\n\nuse `-d` to show directories only.\n\n```\ntree -l 2 -o out.txt -d\n```\n\n#### other arguments\n\nsee [Options](#options).\n\n#### FOR WINDOWS USERS\n\nyou should just use the `treee` command as `tree` has been already taken by windows system.\n\n```\ntreee -l 2 -o out.txt -d\n```\n\n## Options\n\n* --help: outputs a verbose usage listing.\n* --version: outputs the version of tree-cli.\n* --debug: show debug info.\n* --fullpath: prints the full path prefix for each file.\n* --ignore: ignores directory or file you specify - accepts arrays as comma-delimited strings: `'node_modules/, .git/, .gitignore'`\n* --link: follows symbolic links if they point to directories, as if they were directories. Symbolic links that will result in recursion are avoided when detected.\n* --noreport: omits printing of the file and directory report at the end of the tree listing and omits printing the tree on console.\n* --base: specify a root directory. Relative path from cwd root and absolute path are both acceptable. This argument is optional.\n* -a: all files are printed. By default tree does not print hidden files (those beginning with a dot '.'). In no event does tree print the file system constructs '.' (current directory) and '..' (previous directory).\n* -d: list directories only.\n* -f: append a '/' for directories, a '=' for socket files and a '|' for FIFOs.\n* -i: makes tree not print the indentation lines, useful when used in conjunction with the -f option.\n* -l: max display depth of the directory tree.\n* -o: send output to filename.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrraindrop%2Ftree-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrraindrop%2Ftree-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrraindrop%2Ftree-cli/lists"}