You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
537 B
18 lines
537 B
#!/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" |
|
|
|
|