better file management
This commit is contained in:
parent
571138e5a1
commit
7d9f730031
1 changed files with 14 additions and 16 deletions
|
@ -4,7 +4,7 @@ create_ls_entry () {
|
||||||
echo "#+title: =~/$1=" > index.org
|
echo "#+title: =~/$1=" > index.org
|
||||||
echo "* Directories" >> index.org
|
echo "* Directories" >> index.org
|
||||||
if [ "$1" != "" ]; then
|
if [ "$1" != "" ]; then
|
||||||
echo "- [[https://jjanzen.ca/dotfiles/$1..][../]]" >> index.org
|
echo "- [[https://jjanzen.ca/dotfiles/$1..][=../=]]" >> index.org
|
||||||
fi
|
fi
|
||||||
find -- . -maxdepth 1 -type d | sed '/^\.$/d' | sed 's/^\.\///' | while read -r dir; do
|
find -- . -maxdepth 1 -type d | sed '/^\.$/d' | sed 's/^\.\///' | while read -r dir; do
|
||||||
if [ "${dir}" != "*" ]; then
|
if [ "${dir}" != "*" ]; then
|
||||||
|
@ -13,22 +13,20 @@ create_ls_entry () {
|
||||||
done
|
done
|
||||||
echo "* Files" >> index.org
|
echo "* Files" >> index.org
|
||||||
find -- . -maxdepth 1 -type f | sed 's/^\.\///' | while read -r file; do
|
find -- . -maxdepth 1 -type f | sed 's/^\.\///' | while read -r file; do
|
||||||
if test -f "${file}"; then
|
if echo "${file}" | grep -q "\(\.tar\.gz$\|\*|^index\.org$\|^README\.md$\|^\.build\.yml$\|^install$\)"; then
|
||||||
if [ "${file}" = "*" ] || [ "${file}" = "index.org" ] || [ "${file}" = "README.md" ] || [ "${file}" = "LICENSE" ] || [ "${file}" = ".build.yml" ] || echo "${file}" | grep "\.tar\.gz$"; then
|
continue
|
||||||
continue
|
elif [ "${file}" = ".wallpaper" ]; then
|
||||||
elif [ "${file}" = ".wallpaper" ]; then
|
echo "- [[https://wallhaven.cc/w/vgryy5][.wallpaper]]" >> index.org
|
||||||
echo "- [[https://wallhaven.cc/w/vgryy5][.wallpaper]]" >> index.org
|
continue
|
||||||
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
|
|
||||||
fi
|
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
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue