🚧 Added mycd script and cdls alias

This commit is contained in:
z3rOR0ne 2024-11-26 15:06:02 -08:00
parent e964d4895c
commit d448a5f263
3 changed files with 56 additions and 19 deletions

View file

@ -1,5 +1,5 @@
# Custom Aliases
alias .="cd && ls"
alias cdls="source mycd"
alias {les,less,more}="moar -wrap -no-statusbar -style friendly" # -no-linenumbers"
alias {rg,grep}="rg -i --colors 'match:fg:blue' --colors 'line:fg:blue'" # -N
alias {drag,rdrag}="ripdrag"

14
scripts/mycd Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env bash
# TODO: add dependency check for eza, otherwise use ls
# ls after cd
function mycd {
if [ -z "$1" ]; then
builtin cd && eza --icons
else
builtin cd "$1" && eza --icons
fi
}
mycd "$@"

View file

@ -12,8 +12,7 @@ txtyellow=${txtbld}$(tput setaf 3)
txtwhite=${txtbld}$(tput setaf 7)
# Dependency check
function dependencycheck()
{
function dependencycheck() {
numdependencies="$#"
dependencies=("$@")
missingdependencies=0
@ -37,7 +36,8 @@ dependencycheck echo sed
echo "${txtgreen}xtract: a simple shell script for decompressing common file formats"
# Reset output style
tput bold & tput setaf 7
tput bold &
tput setaf 7
# Simply copy and paste, changing extension string and extraction method below
if [ "${1}" == "-tar" ]; then
@ -138,3 +138,26 @@ if [[ "${1}" == "-brotli" || "${1}" == "-br" ]] ; then
echo ".br decompression finished!${txtwhite}"
exit 0
fi
## Taken from reddit for future refactoring of this script:
# function extract()
# {
# if [ -f $1 ] ; then
# case $1 in
# *.tar.bz2) tar xvjf $1 ;;
# *.tar.gz) tar xvzf $1 ;;
# *.bz2) bunzip2 $1 ;;
# *.rar) unrar x $1 ;;
# *.gz) gunzip $1 ;;
# *.tar) tar xvf $1 ;; # NOTE: all calls to tar can be combined (will read automatically)
# *.tbz2) tar xvjf $1 ;;
# *.tgz) tar xvzf $1 ;;
# *.zip) unzip $1 ;;
# *.Z) uncompress $1 ;;
# *.7z) 7z x $1 ;;
# *) echo "'$1' cannot be extracted via >extract<" ;;
# esac
# else
# echo "'$1' is not a valid file!"
# fi
# }