From ab396a97393df34f8b90d8dd6bc626962a9de843 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Fri, 27 Mar 2026 17:13:14 -0700 Subject: [PATCH] Change bye to be a function. Add spaces to the end of some aliases. Fix indentation to consistently be tabs. --- bashrc.sh | 180 +++++++++++++++++++++++++++--------------------------- 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/bashrc.sh b/bashrc.sh index 904719b..f72204d 100644 --- a/bashrc.sh +++ b/bashrc.sh @@ -21,11 +21,11 @@ alias shell-reload="reload-bash" alias reload-shell="reload-bash" alias reload="reload-bash" -alias l='ls' -alias ll='ls -alh' -alias lh='ls -ash' +alias l='ls ' +alias ll='ls -alh ' +alias lh='ls -ash ' -alias clone="rsync -auPhz --delete --exclude '.gradle' --exclude 'app/build'" +alias clone="rsync -auPhz --delete --exclude '.gradle' --exclude 'app/build' " # Easily get to storage devices. curr="`pwd`" @@ -60,16 +60,16 @@ alias clean-trashed='find "$SS" -name ".trashed*" -exec du -h {} \; -delete | so alias check-trashed='find "$SS" -name ".trashed*" -exec du -h {} \; -exec mv -v {} ~/TRASH/ \; | sort -h' # Help prevent mistakes. -alias cp="cp -v" -alias mv="mv -v" +alias cp="cp -v " +alias mv="mv -v " alias rm="echo 'Move to ~/storage/shared/TRASH/ instead!'" # Quickies -alias bye="exit" -alias install="pkg install" -alias uninstall="pkg uninstall" -alias remove="uninstall" -alias scan="nmap -A -p- --script=vuln" +function bye { exit; } +alias install="pkg install " +alias uninstall="pkg uninstall " +alias remove="uninstall " +alias scan="nmap -A -p- --script=vuln " ### Functions ### @@ -77,35 +77,35 @@ alias scan="nmap -A -p- --script=vuln" ## Code Related ## function code-projects { - cat <<- EOF - env-termux dev - env-ansible dev - env-docker dev - nodejs-website dev - hugo-jackanope main + cat <<- EOF + env-termux dev + env-ansible dev + env-docker dev + nodejs-website dev + hugo-jackanope main EOF } function code-reseed { - cd ~/Code - code-projects | while read project branch; do - git clone ssh://git@$GIT_SERVER:$GIT_PORT/$GIT_USER/$project --branch $branch --recurse-submodules - done + cd ~/Code + code-projects | while read project branch; do + git clone ssh://git@$GIT_SERVER:$GIT_PORT/$GIT_USER/$project --branch $branch --recurse-submodules + done } alias reseed-code="code-reseed" function check-code { - cd ~/Code - ls | while read project; do - echo -e "\nChecking $project..." - cd $project - if [[ -d .git ]]; then - git pull - git push - else - echo "* Not a valid git project, skipping." - fi - cd .. - done + cd ~/Code + ls | while read project; do + echo -e "\nChecking $project..." + cd $project + if [[ -d .git ]]; then + git pull + git push + else + echo "* Not a valid git project, skipping." + fi + cd .. + done } alias code-check="check-code" @@ -117,9 +117,9 @@ function commit { echo 'USAGE: commit "My commit message."' >&2 return 1 fi - if [[ "$1" == "-m" ]]; then - message="$2" - fi + if [[ "$1" == "-m" ]]; then + message="$2" + fi git add . && git commit -m "$message" && git push } @@ -140,56 +140,56 @@ alias termux-reload="reload-termux" # Pulled from /me/env-ansible, need to make a shared library between it and Termux. # Change a branch to point at another. function load-branch { - rcvr="$1" # branch which we want to modify - base="$2" # branch with the changes we want +rcvr="$1" # branch which we want to modify +base="$2" # branch with the changes we want - if [[ "$rcvr" == "main" ]]; then - echo "*** ERROR: Are you nuts, fool!? Not main! Do it manually! ***" - return 1 - fi +if [[ "$rcvr" == "main" ]]; then + echo "*** ERROR: Are you nuts, fool!? Not main! Do it manually! ***" + return 1 +fi - if [[ -z "$base" ]]; then - if [[ "$rcvr" == "prod" ]]; then - base="stage" - elif [[ "$rcvr" == "stage" ]]; then - base="dev" - else - echo "* Unsure which branch to use for '$rcvr'. Please specify." - return 1 - fi - echo "* Base was not specified, using '$base' for '$rcvr'." - else - echo "* Requested pointing '$rcvr' branch to '$base'." - fi +if [[ -z "$base" ]]; then + if [[ "$rcvr" == "prod" ]]; then + base="stage" + elif [[ "$rcvr" == "stage" ]]; then + base="dev" + else + echo "* Unsure which branch to use for '$rcvr'. Please specify." + return 1 + fi + echo "* Base was not specified, using '$base' for '$rcvr'." +else + echo "* Requested pointing '$rcvr' branch to '$base'." +fi - echo -e "\n* Ensuring we are on base branch '$base'." && - git switch "$base" && - echo -e "\n* Changing pointer for '$rcvr' to '$base'." && - git branch -f "$rcvr" "$base" && - #echo -e "\n* Switching to branch '$rcvr'." && - #git switch "$rcvr" && - echo -e "\n* Forcing push on branch '$rcvr'." && - git push --force --set-upstream origin "$rcvr" && - echo -e "\n* Done! Displaying list of remote branches." && - git ls-remote --heads | sort +echo -e "\n* Ensuring we are on base branch '$base'." && +git switch "$base" && +echo -e "\n* Changing pointer for '$rcvr' to '$base'." && +git branch -f "$rcvr" "$base" && +#echo -e "\n* Switching to branch '$rcvr'." && +#git switch "$rcvr" && +echo -e "\n* Forcing push on branch '$rcvr'." && +git push --force --set-upstream origin "$rcvr" && +echo -e "\n* Done! Displaying list of remote branches." && +git ls-remote --heads | sort - if [[ "$base" != "dev" ]]; then - echo -e "\n* Checking if a dev branch exists." - git ls-remote --exit-code --heads origin dev - dev_exists="$?" - if [[ "$dev_exists" == 0 ]]; then - echo -e "\n* Switching back to dev." - git switch dev - elif [[ "$dev_exists" == 2 ]]; then - echo -e "\n* Switching back to main." - git switch main - else - echo "*** ERROR: Unknown status for dev_exists, '$dev_exists'. ***" - fi - fi +if [[ "$base" != "dev" ]]; then + echo -e "\n* Checking if a dev branch exists." + git ls-remote --exit-code --heads origin dev + dev_exists="$?" + if [[ "$dev_exists" == 0 ]]; then + echo -e "\n* Switching back to dev." + git switch dev + elif [[ "$dev_exists" == 2 ]]; then + echo -e "\n* Switching back to main." + git switch main + else + echo "*** ERROR: Unknown status for dev_exists, '$dev_exists'. ***" + fi +fi - echo -e "\n* Verifying which branch we're on." - git branch +echo -e "\n* Verifying which branch we're on." +git branch } alias load-prod="load-branch prod" alias load-stage="load-branch stage" @@ -465,15 +465,15 @@ alias pull-icon="pull-meme" function init-video-contents { - if [[ -n "$1" ]]; then - mkdir "$1" - cd "$1" - fi - touch README.md - #touch title.md - #touch desc.md - #touch tags.md - mkdir -pv raw + if [[ -n "$1" ]]; then + mkdir "$1" + cd "$1" + fi + touch README.md + #touch title.md + #touch desc.md + #touch tags.md + mkdir -pv raw } alias init-video="init-video-contents" alias init-vid="init-video"