From 4da10ee1e16b7f78d613dc04986dd2273f78dd4e Mon Sep 17 00:00:00 2001 From: Evan Pratten Date: Thu, 19 Oct 2023 10:55:54 -0400 Subject: [PATCH] Handle SDF things --- configs/shells/bash/macros.sh | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/configs/shells/bash/macros.sh b/configs/shells/bash/macros.sh index 9d8d69d..3d43727 100644 --- a/configs/shells/bash/macros.sh +++ b/configs/shells/bash/macros.sh @@ -1,4 +1,9 @@ -alias ls="ls --color=auto" +# If ls has `--color` support +if ls --color > /dev/null 2>&1; then + alias ls="ls --color=auto" +fi + +# Main aliases alias ll="ls -l" alias la="ls -a" alias :q="exit" @@ -165,3 +170,23 @@ ewconfig-pull() { git pull cd $cwd } + +# Updates the ewconfig on machines that don't have git +ewconfig-pull-zip(){ + cwd=$(pwd) + # If $EWCONFIG_ROOT/.git exists, don't let the user run this + if [ -d $EWCONFIG_ROOT/.git ]; then + echo "You can't run this command when ~/.config/ewconfig is a git repo!" + return 1 + fi + + # Download the latest zip + cd ~/Downloads + curl -L https://ewp.fyi/config.zip -o ewconfig.zip + rm -rf ~/.config/ewconfig + unzip -o ewconfig.zip -d ~/.config/ewconfig + rm ewconfig.zip + + # Return to the original directory + cd $cwd +}