Skip to content
/ lstree Public

System Tree Printer as CLI (with a Node.js API)

License

Notifications You must be signed in to change notification settings

TopCli/lstree

Repository files navigation

lstree

version Maintenance mit OpenSSF Scorecard build

System Tree Printer as CLI (with a Node.js API). Stdout to the terminal the current working dir tree.

Requirements

Getting Started

This package is available in the Node Package Repository and can be easily installed with npm or yarn.

$ npm install @topcli/lstree -g
# or
$ npx @topcli/lstree

Usage example

The package can be used as a binary command or as an API.

import tree from "@topcli/lstree";

const lstree = tree({ depth: 2, ignore: ["test"] });

await lstree(process.cwd());

To use it as a cmd:

$ 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:

interface LStreeOptions {
  ignore?: string[];
  description?: Map<string, string>;
  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.

lstree(__dirname).catch(console.error);

Contributors ✨

All Contributors

Thanks goes to these wonderful people (emoji key):

Gentilhomme
Gentilhomme

💻 📖 👀 🛡️ 🐛
Mark MALAJ
Mark MALAJ

💻
Alexandre Malaj
Alexandre Malaj

📖 👀
MONTES Irvin
MONTES Irvin

📖 👀
PierreDemailly
PierreDemailly

💻 ⚠️

License

MIT