automate/020_lsd.sh

53 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
DEST=${1:-/etc/skel}
ALIAS_DIR=".zsh_aliases.d"
PREFIX=/tmp
NAME=lsd
PROJECT=lsd-rs/lsd
ARCH=$(dpkg --print-architecture)
# RELEASE=$(curl -s https://api.github.com/repos/${PROJECT}/releases/latest | grep tarball_url | cut -d '"' -f 4 | awk -F "/" {'print $8'})
RELEASE=$(lastversion --format=tag ${PROJECT})
RSS_FEED="https://github.com/${USER}/${PROJECT}/releases.atom"
# xdg-open ${RSS_FEED}
echo ${RSS_FEED}
wget -c -P ${PREFIX} https://github.com/lsd-rs/lsd/releases/download/${RELEASE}/${NAME}_${RELEASE#v}_${ARCH}.deb
sudo dpkg -i ${PREFIX}/${NAME}_${RELEASE#v}_amd64.deb
sudo apt -f install
ALIAS_FILE="${DEST}/${ALIAS_DIR}/003_lsd.sh"
cat >"${ALIAS_FILE}" <<-'EOF'
if [ -x /usr/bin/lsd ]; then
alias lsd="/usr/bin/lsd"
# alias 'ls'="lsd"
alias 'll'="lsd -a"
alias 'lt'="lsd --tree"
fi
EOF
# Aliases
#FLAGS
# -a, --all Do not ignore entries starting with .
# --classic Enable classic mode (no colors or icons)
# --help Prints help information
# -h, --human-readable For ls compatibility purposes ONLY, currently set by default
# -F, --classify Append indicator (one of */=>@|) at the end of the file names
# -l, --long Display extended file metadata as a table
# -1, --oneline Display one entry per line
# -R, --recursive Recurse into directories
# -r, --reverse Reverse the order of the sort
# -t, --timesort Sort by time modified
# --tree Recurse into directories and present the result as a tree
# -V, --version Prints version information
#OPTIONS:
# --color <color>... When to use terminal colours [default: auto] [possible values: always, auto, never]
# --date <date>... How to display date [default: date] [possible values: date, relative]
# --depth <num> Stop recursing into directories after reaching specified depth
# --group-dirs <group-dirs>... Sort the directories then the files [default: none] [possible values: none, first, last]
# --icon <icon>... When to print the icons [default: auto] [possible values: always, auto, never]
# --icon-theme <icon-theme>... Whether to use fancy or unicode icons [default: fancy] [possible values: fancy, unicode]