Browse Source

++tree2md

master
Maxim Likhachev 6 years ago committed by Maxim Likhachev
parent
commit
abf7faeab9
  1. 1
      README.md
  2. 18
      tree2md

1
README.md

@ -44,6 +44,7 @@ will create the symbolic link for each script in the \<path> directory.
- [fb2](fb2) opens fb2 files in w3m browser. - [fb2](fb2) opens fb2 files in w3m browser.
- [nt](nt) displays New Testament texts in two languages line by line. - [nt](nt) displays New Testament texts in two languages line by line.
- [spread](spread) opens file in [speedread](https://github.com/pasky/speedread) program via terminal emulator with custom settings. - [spread](spread) opens file in [speedread](https://github.com/pasky/speedread) program via terminal emulator with custom settings.
- [tree2md](tree2md) creates markdown list and links of directory tree.
- [writeup](writeup) opens distracted-free Vim editor with custom color scheme, fonts and plug-ins. - [writeup](writeup) opens distracted-free Vim editor with custom color scheme, fonts and plug-ins.
## Images ## Images

18
tree2md

@ -0,0 +1,18 @@
#!/bin/bash
#Создан: пн 21 окт 2019 22:39:13
#Изменён: ср 11 дек 2019 15:01:28
#
# Создание markdown-списка из дерева файлов
#
# NB: Иногда отображает неправильный уровень вложенности директорий
#
# Идея: https://stackoverflow.com/a/35889620
tree=$(\tree -f --noreport -I '*~' --charset ascii -L "${2:-3}" "${1:-.}" |
sed -E 's/\| +/ /g; s/[|`]-+/ */g; s:\* ((.*/)([^/]+)):- [\3](\1):g; s/ //')
printf "%s\n" "$tree"
Loading…
Cancel
Save