https://github.com/topcli/lstree
System Tree Printer as CLI (with a Node.js API)
https://github.com/topcli/lstree
bin cli folders printer system tree
Last synced: 3 months ago
JSON representation
System Tree Printer as CLI (with a Node.js API)
- Host: GitHub
- URL: https://github.com/topcli/lstree
- Owner: TopCli
- License: mit
- Created: 2018-12-19T15:59:17.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-02-01T07:24:14.000Z (almost 2 years ago)
- Last Synced: 2025-01-19T10:43:07.414Z (11 months ago)
- Topics: bin, cli, folders, printer, system, tree
- Language: JavaScript
- Homepage:
- Size: 193 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# lstree

[](https://github.com/TopCli/lstree/commit-activity)
[](https://github.com/TopCli/lstree/blob/master/LICENSE)
[](https://api.securityscorecards.dev/projects/github.com/TopCli/tlstree)

System Tree Printer as CLI (with a Node.js API). Stdout to the terminal the current working dir tree.
## Requirements
- [Node.js](https://nodejs.org/en/) v14 or higher.
## Getting Started
This package is available in the Node Package Repository and can be easily installed with [npm](https://docs.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com).
```bash
$ npm install @topcli/lstree -g
# or
$ npx @topcli/lstree
```
## Usage example
The package can be used as a binary command or as an API.
```js
import tree from "@topcli/lstree";
const lstree = tree({ depth: 2, ignore: ["test"] });
await lstree(process.cwd());
```
To use it as a cmd:
```bash
$ lstree -d 2
```
Available script arguments are:
| name | type | defaultValue |
| --- | --- | --- |
| -d --depth | number | **0** |
| -s --showfd | boolean | **false** |
| -i --ignore | array | **[]** |
## API
### tree(options?: lstree.options): lstree
Create a new lstree clojure function. Available options are:
```ts
interface LStreeOptions {
ignore?: string[];
description?: Map;
depth?: number;
showFilesDescriptor?: boolean;
showTitle?: boolean;
title?: string;
margin?: {
top?: number;
left?: number;
bottom?: number;
};
}
```
Default ignored files and directories are: `node_modules`, `coverage`, `docs`, `.nyc_output`, `.git`.
### lstree(dir: string, depth?: number): Promise< void >
Call lstree at the wanted location. lstree is an Asynchronous function.
```js
lstree(__dirname).catch(console.error);
```
## Contributors ✨
[](#contributors-)
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

Gentilhomme
💻 📖 👀 🛡️ 🐛

Mark MALAJ
💻

Alexandre Malaj
📖 👀

MONTES Irvin
📖 👀

PierreDemailly
💻 ⚠️
## License
MIT