Skip to main content
Deno 2 is finally here πŸŽ‰οΈ
Learn more

dtree-deno

A simple CLI for generate the dir tree with deno.

  • βœ… Windows
  • βœ… MacOS

Install

  1. Using the following commands
deno install --allow-all --unstable -n dtree https://deno.land/x/deno_tree/src/index.ts
  1. Done, try the following command in terminal
dtree

Install from git

This methos is for non-denoLand install. If you are using the top method to install, you can skip this sections.

  1. Git clone the project first
git clone https://github.com/r48n34/dtree-deno.git
  1. Install with deno task
deno task install
  1. Run with dtree
dtree

Result

Using this repo for samples, the cli will output this result.

dtree
PS D:\github-repo\dtree > dtree
πŸ“‚ .
β”œβ”€β”€ deno.json
β”œβ”€β”€ deno.lock
β”œβ”€β”€ README.md
└─┬ πŸ“‚ src
  β”œβ”€β”€ dir-tree-creator.ts
  └── index.ts

Success to copy to your clipboard.

Config (Optional)

name params Type Description
Shows Hidden folder --hidden, -h boolean Will include the β€˜.’ folder output this result.
No auto copy result --noCopy, -n boolean Will not auto copy the result.
Set max depth tree --maxDepth, -m number Set the max depth generate to the tree
Set No Icon display --noIcon boolean Set the tree display without the icon πŸ“‚
Set Icon display --icon string Set the tree display icon (Default: πŸ“‚)

More demo

--hidden

The --hidden or -h flag will include the β€˜.’ folder output this result.

dtree --hidden
PS D:\github-repo\dtree > dtree --hidden
πŸ“‚ .
β”œβ”€β”¬ πŸ“‚ .git
β”‚ └── ...
β”œβ”€β”€ .gitignore
β”œβ”€β”¬ πŸ“‚ .vscode
β”‚ └── ...
β”œβ”€β”€ deno.json
β”œβ”€β”€ deno.lock
β”œβ”€β”€ README.md
└─┬ πŸ“‚ src
  β”œβ”€β”€ dir-tree-creator.ts
  └── index.ts

Success to copy to your clipboard.

--noCopy

The --noCopy or -n flag will not auto copy the result.

dtree --noCopy
PS D:\github-repo\dtree > dtree --noCopy
πŸ“‚ .
β”œβ”€β”€ deno.json
β”œβ”€β”€ deno.lock
β”œβ”€β”€ README.md
└─┬ πŸ“‚ src
  β”œβ”€β”€ dir-tree-creator.ts
  └── index.ts

--maxDepth

The --maxDepth or -m flag can set the max depth generate to the tree.
Default: Infinity

dtree --maxDepth <number>
# Set a max depth to 1
PS D:\github-repo\dtree> dtree -m 1
πŸ“‚ .
β”œβ”€β”€ deno.json
β”œβ”€β”€ deno.lock
β”œβ”€β”€ README.md
└── πŸ“‚ src

Success to copy to your clipboard.

--noIcon

The --noIcon flag can the tree display without the icon πŸ“‚.

dtree --noIcon
PS D:\github-repo\dtree> dtree --noIcon
.
β”œβ”€β”€ deno.json
β”œβ”€β”€ deno.lock
β”œβ”€β”€ README.md
└─┬ src
  β”œβ”€β”€ archy.ts
  β”œβ”€β”€ dir-tree-creator.ts
  β”œβ”€β”€ help.ts
  β”œβ”€β”€ index.ts
  └─┬ interface
    └── interface.ts

Success to copy to your clipboard.

--icon

The --icon flag can the tree display icon to your icons.
Default: πŸ“‚

dtree --icon <string>
PS D:\github-repo\dtree> dtree --icon πŸ“¦
πŸ“¦ .
β”œβ”€β”€ deno.json
β”œβ”€β”€ deno.lock
β”œβ”€β”€ README.md
└─┬ πŸ“¦ src
  β”œβ”€β”€ archy.ts
  β”œβ”€β”€ dir-tree-creator.ts
  β”œβ”€β”€ help.ts
  β”œβ”€β”€ index.ts
  └─┬ πŸ“¦ interface
    └── interface.ts

Success to copy to your clipboard.

Notices

  1. The script will default to ignore all __pycache__ and node_modules related files. Unless you are using the command inside either one of the folder.

Uninstall

deno uninstall dtree