如何制作README中文件夹树状图,树形图

效果如下:

basic_demo
├── hs_assert
│   ├── hs_assert.c
│   └── hs_assert.h
├── hs_common
│   ├── hs_list.h
│   ├── hs_rbtree.h
│   ├── lwrb.c
│   ├── lwrb.h
│   ├── lwrb_ex.c
│   └── rbtree.c
├── hs_log
│   ├── hs_log.c
│   └── hs_log.h
├── hs_test
│   ├── unity.c
│   ├── unity.h
│   ├── unity_fixture.c
│   ├── unity_fixture.h
│   ├── unity_fixture_internals.h
│   ├── unity_internals.h
│   ├── unity_memory.c
│   └── unity_memory.h
├── letter-shell
│   └── src
│       ├── shell.c
│       ├── shell.h
│       ├── shell_cfg.h
│       ├── shell_cmd_list.c
│       ├── shell_companion.c
│       ├── shell_ext.c
│       ├── shell_ext.h
│       ├── shell_hs_cmd.c
│       ├── shell_port.c
│       └── shell_port.h
├── mdk
│   ├── Listings
│   ├── Objects
│   │   ├── ExtDll.iex
│   │   ├── uart_test.asm
│   │   ├── uart_test.axf
│   │   ├── uart_test.bin
│   │   └── uart_test.hex
│   ├── EventRecorderStub.scvd
│   ├── JLinkLog.txt
│   ├── JLinkSettings.ini
│   ├── uart_test.uvguix.machao21
│   ├── uart_test.uvoptx
│   └── uart_test.uvprojx
├── unit_test
│   ├── TestUnityAssert.c
│   ├── TestUnityHsAssert.c
│   ├── TestUnityList.c
│   ├── TestUnityLog.c
│   ├── TestUnityLwrb.c
│   ├── TestUnityTemplate.c
│   └── all_tests.c
├── README.txt
├── basic_demo说明文件.docx
├── dir.txt
├── dir1.txt
├── hs_support_config.h
├── test_hal_uart_common.c
├── test_hal_uart_common.h
├── test_hal_uart_int.c
└── 删除编译信息文件(缩小体积方便备份).bat
 

Windows平台cmd命令中有自带的tree命令,但是tree功能比较简单,没有过滤等功能,同时做的树状图比较难看。所以经过搜索找到了treee工具,做的树状图比较好看同时有过滤机制。

具体安装流程

1. 下载 Node.js 

2. 安装 tree-node-cli

CMD命令下载 tree-node-cli

npm install -g tree-node-cli
treee --version         # 查看版本是否安装成功
npm uninstall -g tree-node-cli    #删除

3.打印树状图并重定向输出到文件

treee -L 3 -I "node_modules|.idea|objects|.git" -a --dirs-first > dir1.txt

解释

  • windows用户需要用treee代替tree,避免和系统的tree命令冲突。 treee

  • 指定路径的级别为3级。

    -L 3

  • 忽略文件夹(正则表达式匹配的,.git会匹配到.gitignore,所以.gitignore文件没有显示出来)。

    -I "node_modules|.idea|objects|.git"

  • 显示所有文件(默认前缀有"."的不会显示,例如".electron-vue")。

    -a

  • 目录在前,文件在后(默认是字母排序,和idea显示的顺序不一致)。

    --dirs-first

  • 9
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值