diff options
author | Jacob Janzen <jjanzenn@proton.me> | 2024-08-08 20:32:54 -0500 |
---|---|---|
committer | Jacob Janzen <jjanzenn@proton.me> | 2024-08-08 20:32:54 -0500 |
commit | 7d9f730031e72fa721a22b4f09b64c60027db57d (patch) | |
tree | 3990cb5870c00319e6e10f3bac150cc9be1a2c5f /fix-dotfile-paths.sh | |
parent | 571138e5a1c2328b4332b39f7d610dbdece3768b (diff) |
better file management
Diffstat (limited to 'fix-dotfile-paths.sh')
-rwxr-xr-x | fix-dotfile-paths.sh | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/fix-dotfile-paths.sh b/fix-dotfile-paths.sh index 02cf0ae..004f646 100755 --- a/fix-dotfile-paths.sh +++ b/fix-dotfile-paths.sh @@ -4,7 +4,7 @@ create_ls_entry () { echo "#+title: =~/$1=" > index.org echo "* Directories" >> index.org if [ "$1" != "" ]; then - echo "- [[https://jjanzen.ca/dotfiles/$1..][../]]" >> index.org + echo "- [[https://jjanzen.ca/dotfiles/$1..][=../=]]" >> index.org fi find -- . -maxdepth 1 -type d | sed '/^\.$/d' | sed 's/^\.\///' | while read -r dir; do if [ "${dir}" != "*" ]; then @@ -13,22 +13,20 @@ create_ls_entry () { done echo "* Files" >> index.org find -- . -maxdepth 1 -type f | sed 's/^\.\///' | while read -r file; do - if test -f "${file}"; then - if [ "${file}" = "*" ] || [ "${file}" = "index.org" ] || [ "${file}" = "README.md" ] || [ "${file}" = "LICENSE" ] || [ "${file}" = ".build.yml" ] || echo "${file}" | grep "\.tar\.gz$"; then - continue - elif [ "${file}" = ".wallpaper" ]; then - echo "- [[https://wallhaven.cc/w/vgryy5][.wallpaper]]" >> index.org - continue - fi - - if echo "${file}" | grep -q "\.org$"; then - new_file=$(basename "$(grep '#+begin_src' "${file}" | head -1 | cut -d ' ' -f 4)") - else - new_file=$file - fi - html=$(echo "${file}" | sed 's/\.org$/\.html/') - echo "- [[https://jjanzen.ca/dotfiles/$1${html}][${new_file}]]" >> index.org + if echo "${file}" | grep -q "\(\.tar\.gz$\|\*|^index\.org$\|^README\.md$\|^\.build\.yml$\|^install$\)"; then + continue + elif [ "${file}" = ".wallpaper" ]; then + echo "- [[https://wallhaven.cc/w/vgryy5][.wallpaper]]" >> index.org + continue fi + + if echo "${file}" | grep -q "\.org$"; then + new_file=$(basename "$(grep -q '#+begin_src' "${file}" | head -1 | cut -d ' ' -f 4)") + else + new_file=$file + fi + html=$(echo "${file}" | sed 's/\.org$/\.html/') + echo "- [[https://jjanzen.ca/dotfiles/$1${html}][=${new_file}=]]" >> index.org done } |