add: zsh files
This commit is contained in:
parent
8c2bd11821
commit
70a565df77
3 changed files with 50 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.idea/
|
2
files/%HOME/.zsh_preferences
Normal file
2
files/%HOME/.zsh_preferences
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
_ZSH_PREF_NO_PFETCH=0
|
||||||
|
_ZSH_PREF_NO_NONSENSE=0
|
47
files/%HOME/.zsh_scripts
Normal file
47
files/%HOME/.zsh_scripts
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
__is_arch() {
|
||||||
|
. /etc/os-release
|
||||||
|
if [ "$ID" = "arch" ]; then return 0; else return 1; fi
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_once() {
|
||||||
|
if [ ! __is_arch ]; then
|
||||||
|
printf "This command is only for Arch Linux.\n"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [ ! -n "$1" ]; then
|
||||||
|
printf "Usage: pkg_once <PACKAGE_NAME> [command]\n"
|
||||||
|
printf "command is optional; if there is no command the package name is ran\n"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
printf "Installing $1...\n"
|
||||||
|
yay -S --noconfirm $1 > /dev/null
|
||||||
|
|
||||||
|
if [ ! -n "$2" ]; then $1; else $2; fi
|
||||||
|
printf "Remoiving $1..."
|
||||||
|
yay -R --noconfirm $1 > /dev/null
|
||||||
|
echo "done.\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
rando () {
|
||||||
|
case $1 in
|
||||||
|
*|d|default) tr -dc A-Za-z0-9 </dev/urandom | head -c $2 ; echo '' ;;
|
||||||
|
s|special) tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' </dev/urandom | head -c $2 ; echo ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
touchx () {
|
||||||
|
case $1 in
|
||||||
|
--shebang) content="#!/bin/sh"; file=$2 ;;
|
||||||
|
*) file=$1 ;;
|
||||||
|
esac
|
||||||
|
if [ -s $file ]; then
|
||||||
|
printf 'file exists'
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
touch $file
|
||||||
|
if [ -n "$content" ]; then
|
||||||
|
printf '%s\n' $content >> $file
|
||||||
|
fi
|
||||||
|
chmod +x $file
|
||||||
|
printf '%s' $file
|
||||||
|
}
|
Loading…
Reference in a new issue