diff --git a/.config/shell/functions/cda b/.config/shell/functions/cda index dc68881..751734b 100644 --- a/.config/shell/functions/cda +++ b/.config/shell/functions/cda @@ -1,4 +1,5 @@ #!/bin/bash +# Source this and then run `cda` # cd all: opens a new shell in each of the directories below the one you're in, so # you can execute commands in them until you type 'exit' diff --git a/.config/shell/functions/cdf b/.config/shell/functions/cdf index 2a41582..2da88f3 100644 --- a/.config/shell/functions/cdf +++ b/.config/shell/functions/cdf @@ -1,4 +1,5 @@ #!/bin/bash +# Source this and then run `cdf` # cd find (interactive): cd to the containing dir of a file, or inside a folder, given part of its name # Basically, an interactive version of what's above diff --git a/.config/shell/functions/cds b/.config/shell/functions/cds index 8dffc0a..3950487 100644 --- a/.config/shell/functions/cds +++ b/.config/shell/functions/cds @@ -1,4 +1,5 @@ #!/bin/bash +# Source this and then run `cds` # cd search: cd to a directory, given part of its name # (also can take arguments for an `fd` commnd) diff --git a/.config/shell/functions/gloned b/.config/shell/functions/gloned index 9faa9a1..cbad021 100644 --- a/.config/shell/functions/gloned +++ b/.config/shell/functions/gloned @@ -1,4 +1,5 @@ #!/bin/bash +# Source this and then run `gloned` # Git cLONE cD # Can take extra arguments for git (ex: gloned url:/repo folder) @@ -7,13 +8,12 @@ gloned() { # remove the url up to the last segment, and remove the .git from the end - REPO_DIR="${2:-"$(echo "${1%%.git}" | rev | cut -d '/' -f 1 | rev)"}" + REPO_DIR="${2:-"$(echo "${1%.git}" | rev | cut -d '/' -f 1 | rev)"}" - git clone "$1" "$REPO_DIR" || exit $? - ls + git clone "$1" "$REPO_DIR" || return $? if ! cd "$REPO_DIR";then echo 'Error: Could not `cd` into the repo' - exit 1 + return 1 fi echo # ls --color=auto diff --git a/.config/shell/functions/todo b/.config/shell/functions/todo index e2be379..a388225 100644 --- a/.config/shell/functions/todo +++ b/.config/shell/functions/todo @@ -1,4 +1,5 @@ #!/bin/bash +# Source this and then run `todo` # a simple way to manage your todo list # Usage: @@ -9,12 +10,13 @@ # Suggested use: make a git repo for holding your todo list, then make # a symlink called 'todo' that points to your todo list in your home directory # + todo() { todo_dir="$(dirname "$(realpath ~/todo)")" todo_file="$(realpath ~/todo)" if [ -z "$*" ];then ( # subshell to protect against directory changes - cd "$todo_dir" || exit + cd "$todo_dir" || return # pull the latest commits git rev-parse && @@ -31,7 +33,7 @@ todo() { ) elif [ "$*" = "cd" ]; then - cd "$todo_dir" || exit + cd "$todo_dir" || return else git -C "$todo_dir" $@ fi