diff options
-rwxr-xr-x | fix-dotfile-paths.sh | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/fix-dotfile-paths.sh b/fix-dotfile-paths.sh index 59db2bd..f724540 100755 --- a/fix-dotfile-paths.sh +++ b/fix-dotfile-paths.sh @@ -7,22 +7,19 @@ create_ls_entry () { 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 + if [ "${dir}" != "*" ] && [ "${dir}" != ".git" ]; then echo "- [[https://jjanzen.ca/dotfiles/$1${dir}][=${dir}/=]]" >> index.org fi done echo "* Files" >> index.org find -- . -maxdepth 1 -type f | sed 's/^\.\///' | while read -r file; do - if echo "${file}" | grep -q "\(\.tar\.gz$\|\*|^index\.org$\|^README\.md$\|^\.build\.yml$\|^install$\|^LICENSE$\)"; then - continue - elif [ "${file}" = ".wallpaper" ]; then + if [ "${file}" = ".wallpaper" ]; then echo "- [[https://wallhaven.cc/w/vgryy5][=.wallpaper=]]" >> index.org - continue + elif echo "${file}" | grep -q "\.org$" && [ "${file}" != "index.org" ]; then + new_file=$(basename "$(grep '#+begin_src' "${file}" | head -1 | cut -d ' ' -f 4)") + html=$(echo "${file}" | sed 's/\.org$/\.html/') + echo "- [[https://jjanzen.ca/dotfiles/$1${html}][=${new_file}=]]" >> index.org fi - - new_file=$(basename "$(grep -q '#+begin_src' "${file}" | head -1 | cut -d ' ' -f 4)") - html=$(echo "${file}" | sed 's/\.org$/\.html/') - echo "- [[https://jjanzen.ca/dotfiles/$1${html}][=${new_file}=]]" >> index.org done } |