diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/rc.sh | 30 | ||||
-rwxr-xr-x | bin/update-scripts-repo.sh | 12 |
2 files changed, 39 insertions, 3 deletions
diff --git a/bin/rc.sh b/bin/rc.sh new file mode 100755 index 0000000..2220893 --- /dev/null +++ b/bin/rc.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +### +RED=$(tput setaf 1) +MAGENTA=$(tput setaf 5) +CYAN=$(tput setaf 6) +NORMAL=$(tput sgr0) +### + +usage () { + printf "%s\t%s\n\n%s\n %s\t%s\n %s\t%s\n" \ + "Usage:" "$(basename "$0") [options] [filename]" \ + "Basic options:" \ + "-h" "show this help page" \ + "-d" "dESTROY the waste bin's content" + exit "$1" +} + +[ ${#} -eq 1 ] || usage 1 +WASTE="$1" +[ -f "$WASTE" ] || [ -d "$WASTE" ] || usage 1 + +WASTE_BIN="$HOME/.local/waste_bin" +[ -d "$WASTE_BIN" ] || \ + ( mkdir "$WASTE_BIN" && \ + printf "%s[Creating the following directory : %s]%s\n" "$MAGENTA" "$WASTE_BIN" "$NORMAL" ) + +printf "%s[Moving %s to the waste bin]%s\n" "$CYAN" "$1" "$NORMAL" +mv --verbose --target-directory="$WASTE_BIN" "$1" || \ + printf "%s[An error occured while moving %s to %s]%s\n" "$RED" "$1" "$WASTE_BIN" "$NORMAL" diff --git a/bin/update-scripts-repo.sh b/bin/update-scripts-repo.sh index 89bfa36..e699472 100755 --- a/bin/update-scripts-repo.sh +++ b/bin/update-scripts-repo.sh @@ -3,6 +3,12 @@ SCRIPTS_REPO_PATH="$HOME/workbench/scripts/" -cp -rv "$HOME/.local/usr/local/bin" "$SCRIPTS_REPO_PATH" -cp -rv "$HOME/workbench/auto-void-packages" "$SCRIPTS_REPO_PATH" -cp -rv "$HOME/workbench/ansible" "$SCRIPTS_REPO_PATH" +pushd "$SCRIPTS_REPO_PATH" || exit 1 + +cp -rv "$HOME/.local/usr/local/bin" . +cp -rv "$HOME/workbench/auto-void-packages" . +cp -rv "$HOME/workbench/ansible" . + +git add . && git commit && git push -v --progress + +popd || exit 1 |