@@ -12,27 +12,27 @@ ORANGE='\033[0;33'
1212RED=' \033[0;31m'
1313RESET=' \033[0m'
1414
15- function LOG(){
15+ function LOG() {
1616 echo -e " $@ ${RESET} "
1717}
1818
19- function INFO(){
19+ function INFO() {
2020 LOG ${GREEN} $@
2121}
2222
23- function WARN(){
23+ function WARN() {
2424 LOG ${ORANGE} $@
2525}
2626
27- function ERROR(){
27+ function ERROR() {
2828 LOG ${RED} $@
2929}
3030
3131# print the current system details
3232# this expects DOTFILES_DIR and SYSTEM to be defined
33- function print_details(){
33+ function print_details() {
3434 LOG ${BWHITE} \
35- "
35+ "
3636SYSTEM: $SYSTEM
3737OS: $OS
3838KERNEL: $KERNEL
@@ -47,82 +47,82 @@ DOTFILES_DIR: $DOTFILES_DIR
4747
4848# function to create my links
4949# This expects the variable $DOTFILES_DIR to exist
50- function sym_links(){
50+ function sym_links() {
5151 INFO " Creating symlinks..."
5252 mkdir -p $HOME /.config
5353 stow -v --dotfiles --adopt --dir $DOTFILES_DIR --target $HOME --restow home
54- stow -v --adopt --dir $DOTFILES_DIR /private/ --target $HOME /.ssh --restow .ssh
54+ [[ -d $DOTFILES /private/.ssh ]] && stow -v --adopt --dir $DOTFILES_DIR /private/ --target $HOME /.ssh --restow .ssh
5555 stow -v --adopt --dir $DOTFILES_DIR --target $HOME /.config/ --restow config
5656 # if the adopt made a local change then undo that
5757 git checkout HEAD -- config home private
5858
5959 return 0
6060}
6161
62- function ask(){
62+ function ask() {
6363 read -p " $1 [$2 ] " answer
6464 answer=" ${answer:- $2 } "
6565 case " $answer " in
66- y|Y ) return 0;;
67- n|N ) return 1;;
68- * ) ask " $1 " " $2 " ;;
66+ y | Y ) return 0 ;;
67+ n | N ) return 1 ;;
68+ * ) ask " $1 " " $2 " ;;
6969 esac
7070}
7171
7272# ############################## Ubuntu specifics #########################################
73- function no_ppa_exists(){
74- ppa_added=` grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep -v list.save | grep -v deb-src | grep deb | grep $1 | wc -l`
75- [ $ppa_added == 0 ];
73+ function no_ppa_exists() {
74+ ppa_added=$( grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep -v list.save | grep -v deb-src | grep deb | grep $1 | wc -l)
75+ [ $ppa_added == 0 ]
7676}
7777
78- function add_ppa(){
78+ function add_ppa() {
7979 sudo add-apt-repository ppa:$1 -y
8080 apt_update
8181
8282 return 0
8383}
8484
85- function apt_update(){
85+ function apt_update() {
8686 sudo apt-get update 1> /dev/null
8787}
8888
89- function apt_install(){
89+ function apt_install() {
9090 sudo apt-get install -y $@
9191
9292 return 0
9393}
9494
95- function pac_update(){
95+ function pac_update() {
9696 sudo pacman -Syu --noconfirm
9797
9898 return 0
9999}
100100
101- function pac_install(){
101+ function pac_install() {
102102 sudo pacman -S --needed --noconfirm $@
103103
104104 return 0
105105}
106106
107- function yay_install(){
107+ function yay_install() {
108108 yay -S --needed --noconfirm $@ --mflags " --nocheck"
109109
110110 return 0
111111}
112112
113- function yay_update(){
113+ function yay_update() {
114114 yay -Syu --noconfirm
115115
116116 return 0
117117}
118118
119- function pip3_install(){
119+ function pip3_install() {
120120 sudo -H pip3 install $@
121121
122122 return 0
123123}
124124
125- function sudo_rule(){
125+ function sudo_rule() {
126126 INFO " $USER ALL = NOPASSWD: $@ " | sudo tee -a /etc/sudoers
127127
128128 return 0
@@ -131,7 +131,7 @@ function sudo_rule(){
131131# ########################### manual install items ########################################
132132
133133# setup fzf
134- function fzf_install(){
134+ function fzf_install() {
135135 mkdir -p $HOME /.local/bin
136136 rm -rf $HOME /.fzf
137137 git clone --depth 1 https://github.com/junegunn/fzf.git $HOME /.fzf
@@ -142,7 +142,7 @@ function fzf_install(){
142142}
143143
144144# install lazygit
145- function lazygit_install(){
145+ function lazygit_install() {
146146 LAZYGIT_VERSION=$( curl -s " https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | \g rep -Po ' "tag_name": "v\K[^"]*' )
147147 cd /tmp
148148 curl -Lo lazygit.tar.gz " https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION} _Linux_x86_64.tar.gz"
@@ -152,7 +152,7 @@ function lazygit_install(){
152152}
153153
154154# install lunarvim
155- function lunarvim_install(){
155+ function lunarvim_install() {
156156 INFO " Installing LunarVIM..."
157157 NPM_CONFIG_PREFIX=$HOME /npm-global
158158
@@ -163,7 +163,7 @@ function lunarvim_install(){
163163}
164164
165165# setup starship
166- function starship_install(){
166+ function starship_install() {
167167 INFO " Installing starship..."
168168 curl -sS https://starship.rs/install.sh -o starship.sh
169169 chmod +x starship.sh
@@ -172,7 +172,7 @@ function starship_install(){
172172}
173173
174174# install the various zsh components
175- function zsh_extras(){
175+ function zsh_extras() {
176176 INFO " Setting up zsh extras..."
177177 # install zgenom
178178 [ ! -d $HOME /.zgenom ] && git clone https://github.com/jandamm/zgenom.git ${HOME} /.zgenom
@@ -183,5 +183,5 @@ function zsh_extras(){
183183 # install fonts
184184 mkdir -p $HOME /.local/bin
185185 curl -fsSL https://raw.githubusercontent.com/getnf/getnf/main/install.sh | bash
186- $HOME /.local/bin/getnf -i DejaVuSansMono,DroidSansMono,Hack,Recursive,RobotoMono | true # don't fail on fonts
186+ $HOME /.local/bin/getnf -i DejaVuSansMono,DroidSansMono,Hack,Recursive,RobotoMono | true # don't fail on fonts
187187}
0 commit comments