An open API service indexing awesome lists of open source software.

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)

Awesome Lists containing this project

README

          

# lstree
![version](https://img.shields.io/badge/dynamic/json.svg?style=for-the-badge&url=https://raw.githubusercontent.com/TopCli/lstree/master/package.json&query=$.version&label=Version)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg?style=for-the-badge)](https://github.com/TopCli/lstree/commit-activity)
[![mit](https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge)](https://github.com/TopCli/lstree/blob/master/LICENSE)
[![OpenSSF
Scorecard](https://api.securityscorecards.dev/projects/github.com/TopCli/lstree/badge?style=for-the-badge)](https://api.securityscorecards.dev/projects/github.com/TopCli/tlstree)
![build](https://img.shields.io/github/actions/workflow/status/TopCli/lstree/node.js.yml?style=for-the-badge)

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 ✨

[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-)

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):



Gentilhomme
Gentilhomme

💻 📖 👀 🛡️ 🐛
Mark MALAJ
Mark MALAJ

💻
Alexandre Malaj
Alexandre Malaj

📖 👀
MONTES Irvin
MONTES Irvin

📖 👀
PierreDemailly
PierreDemailly

💻 ⚠️

## License
MIT