CNode

没事写了一个针对Node.js 的文件树

分享
Yyujintang发布于9 年前最后回复9 年前4 回复5131 浏览0 收藏

平时喜欢使用tree查看某个项目的目录结构,但是tree命令遇到node_modules,这个就很不友好了,然后自己撸了一个tree2,上效果 先上github地址:https://github.com/yujintang/tree2 untitled1.png

使用也很简单,API如下:

模仿linux tree

可以做到文件过滤,使其使用更方便

安装

$npm install tree2 -g

使用

$tree2 

show 某个文件夹下内容

$tree2 /xx/xx/x

查看常规Node.js 文件目录树

不展开node_modules, 同时进行配色

$tree2 -a

对文件树进行保存

将该文件树保存到该命令下的tree2.md

$tree2 -s

详细例子

如将/usr/local 下文件进行tree, 并且配色, 不展开 node_modules, go 两个文件夹下的内容, 最后保存

$tree2 -c -i go,node_modules -s /usr/local

具体用法

$tree2 -h 

里面主要用了commander和chalk,但是配色并不是太好看,有想法的同学们给点意见什么的啦,github地址在这:https://github.com/yujintang/tree2

查看回复

回复 (4)

I
i5ting#1·9 年前

必须star啊,代码也挺规范

I
i5ting#2·9 年前

把autojump也重写了吧

Y
yujintang#3·9 年前
引用 i5ting把autojump也重写了吧

@i5ting 谢老大star啦,这些小程序可以顺便练手的

D
DuanPengfei#4·9 年前

这个可以有,必须 star 去了。

参与回复
登录后即可参与回复。登录