diff --git a/.gitignore b/.gitignore index 24b5f75..0701d76 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea *.iml *.zip +_profile _site* .repo_* diff --git a/DIRECTORY_TREE.md b/DIRECTORY_TREE.md index 71f5693..fd03180 100644 --- a/DIRECTORY_TREE.md +++ b/DIRECTORY_TREE.md @@ -1,47 +1,47 @@ ## Дерево каталогов
-. -├─ jekyll_site -│ ├─ css/pomodoro5.css -│ ├─ en -│ │ ├─ 2023 -│ │ │ ├─ 01/04/drawing-simple-captcha.md -│ │ │ ├─ 02/06/function-graph-in-console.md -│ │ │ ├─ 03/08/drawing-heart-in-console.md -│ │ │ ├─ 06/20/password-generator.md -│ │ │ └─ 08/04/directory-tree.md -│ │ └─ index.md -│ ├─ img -│ │ ├─ captcha.png -│ │ ├─ circumference-equation.svg -│ │ ├─ heart-graph.png -│ │ ├─ heart-monospaced-plain-22.bmp -│ │ ├─ rhombus-equation.svg -│ │ └─ square-equations.svg -│ ├─ js/password-generator.js -│ ├─ ru -│ │ ├─ 2023 -│ │ │ ├─ 01/03/drawing-simple-captcha.md -│ │ │ ├─ 02/05/function-graph-in-console.md -│ │ │ ├─ 03/08/drawing-heart-in-console.md -│ │ │ ├─ 06/19/password-generator.md -│ │ │ └─ 08/03/directory-tree.md -│ │ └─ index.md -│ ├─ Gemfile_color -│ ├─ Gemfile_older -│ ├─ _config_color.yml -│ ├─ _config_older.yml -│ └─ robots.txt -├─ .gitattributes -├─ .gitignore -├─ CONTRIBUTING.md -├─ DIRECTORY_TREE.md -├─ LICENSE.md -├─ OPEN_LICENSE.txt -├─ README.md -├─ WIKI.md -├─ build.sh -├─ package.sh -└─ serve.sh +. +├─ jekyll_site +│ ├─ css/pomodoro5.css 88 +│ ├─ en +│ │ ├─ 2023 +│ │ │ ├─ 01/04/drawing-simple-captcha.md 10K +│ │ │ ├─ 02/06/function-graph-in-console.md 6,3K +│ │ │ ├─ 03/08/drawing-heart-in-console.md 12K +│ │ │ ├─ 06/20/password-generator.md 3,8K +│ │ │ └─ 08/04/directory-tree.md 3,1K +│ │ └─ index.md 4,1K +│ ├─ img +│ │ ├─ captcha.png 6,6K +│ │ ├─ circumference-equation.svg 11K +│ │ ├─ heart-graph.png 22K +│ │ ├─ heart-monospaced-plain-22.bmp 170 +│ │ ├─ rhombus-equation.svg 9,2K +│ │ └─ square-equations.svg 18K +│ ├─ js/password-generator.js 1,4K +│ ├─ ru +│ │ ├─ 2023 +│ │ │ ├─ 01/03/drawing-simple-captcha.md 15K +│ │ │ ├─ 02/05/function-graph-in-console.md 8,1K +│ │ │ ├─ 03/08/drawing-heart-in-console.md 15K +│ │ │ ├─ 06/19/password-generator.md 4,8K +│ │ │ └─ 08/03/directory-tree.md 4,3K +│ │ └─ index.md 6,0K +│ ├─ Gemfile_color 68 +│ ├─ Gemfile_older 68 +│ ├─ _config_color.yml 1,5K +│ ├─ _config_older.yml 1,5K +│ └─ robots.txt 178 +├─ .gitattributes 508 +├─ .gitignore 42 +├─ CONTRIBUTING.md 557 +├─ DIRECTORY_TREE.md 4,8K +├─ LICENSE.md 955 +├─ OPEN_LICENSE.txt 25K +├─ README.md 275 +├─ WIKI.md 1,3K +├─ build.sh 2,8K +├─ package.sh 189 +└─ serve.sh 267diff --git a/jekyll_site/en/2023/08/04/directory-tree.md b/jekyll_site/en/2023/08/04/directory-tree.md index 3d803fd..9d865eb 100644 --- a/jekyll_site/en/2023/08/04/directory-tree.md +++ b/jekyll_site/en/2023/08/04/directory-tree.md @@ -44,7 +44,10 @@ function directory_tree { # prefix of current element, collapse singletons into one line [ "$4" == "one" ] && printf '%s' "/" || printf '\n%s' "$head" # current element of the tree — relative hyperlink - printf '%s' "${path##*/}" + printf '%s' "${path#*/}" "${path##*/}" + # suffix of current element — file size in smaller font + [ -f "$path" ] && printf ' %s' \ + "$(stat -c %s "$path" | numfmt --to=iec --round=nearest)" # recursive calls for subdirectories if [ -d "$path" ]; then local i # counter diff --git a/jekyll_site/ru/2023/08/03/directory-tree.md b/jekyll_site/ru/2023/08/03/directory-tree.md index 44e1b22..6cadde0 100644 --- a/jekyll_site/ru/2023/08/03/directory-tree.md +++ b/jekyll_site/ru/2023/08/03/directory-tree.md @@ -43,7 +43,10 @@ function directory_tree { # префикс текущего элемента, сворачивать синглтоны в одну строку [ "$4" == "one" ] && printf '%s' "/" || printf '\n%s' "$head" # текущий элемент дерева — относительная гиперссылка - printf '%s' "${path##*/}" + printf '%s' "${path#*/}" "${path##*/}" + # суффикс текущего элемента — размер файла меньшим шрифтом + [ -f "$path" ] && printf ' %s' \ + "$(stat -c %s "$path" | numfmt --to=iec --round=nearest)" # рекурсивные вызовы для подкаталогов if [ -d "$path" ]; then local i # счётчик @@ -60,7 +63,7 @@ function directory_tree { } # строка исключений для "ls" из списка неотслеживаемых файлов ".gitignore" exclusions="-I'.git' $(sed -E "s|^(.*)$|-I'\1'|" .gitignore | tr '\n' ' ')" -# помещаем дерево в контейнер, добавляем заголовок и выводим в файл +# поместить дерево в контейнер, добавить заголовок и вывести в файл printf '%s\n' "## Дерево каталогов" "" "
" \ "$(directory_tree . | grep '\S')" "" >DIRECTORY_TREE.md ```