Adds powerline stuff.
This commit is contained in:
@@ -210,3 +210,71 @@ alias wget-rip-lite='wget --page-requisites --convert-links --adjust-extension -
|
||||
alias mount-nas='mkdir -p ~/nas/tom && sshfs deepthought:/mnt/Data/Private/Homes/tom ~/nas/tom'
|
||||
alias installlocalbin='function f() { sudo install -m 755 -o root -g root "$1" /usr/local/bin ; unset -f f; } f'
|
||||
alias installuserbin='function f() { mkdir -p ~/bin ; cp "$1" ~/bin/ ; unset -f f; } f'
|
||||
|
||||
packdir() {
|
||||
# Check if an argument was provided
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "Error: Missing folder name." >&2
|
||||
echo "Usage: packdir <folder_name>" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Strip any trailing slashes to prevent name formatting issues
|
||||
local target="${1%/}"
|
||||
|
||||
# Verify that the target exists and is a directory
|
||||
if [[ ! -d "$target" ]]; then
|
||||
echo "Error: Directory '$target' does not exist." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Prevent accidental destruction of root or parent references
|
||||
if [[ "$target" == "." || "$target" == ".." || "$target" == "/" ]]; then
|
||||
echo "Error: Refusing to compress critical path '$target'." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local archive="${target}.tar.bz2"
|
||||
|
||||
# Verify the archive file doesn't already exist to avoid accidental overwrite
|
||||
if [[ -e "$archive" ]]; then
|
||||
echo "Error: Archive '$archive' already exists." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Create archive and only remove the original folder if tar succeeds
|
||||
tar -jcvf "$archive" "$target" && rm -rf "$target"
|
||||
}
|
||||
|
||||
clone() {
|
||||
if [ -z "$1" -o "$1" = " " -o -z "$2" -o "$2" = " " ]; then
|
||||
echo "Clones the repo into \$PROJECT_ROOT/<projectName>"
|
||||
echo "usage: clone <repositoryUrl> <projectName>"
|
||||
return
|
||||
fi
|
||||
|
||||
git clone "$1" "$2"
|
||||
}
|
||||
|
||||
# Use like this
|
||||
# some-command && sleep 1 ; alert-me -s -t -f --success-message --success-title --failure-message --failure-title --title
|
||||
# osascript -e 'display notification "The command worked" with title "Success"'
|
||||
# osascript -e 'display notification "The command failed" with title "Failed"'
|
||||
alert-me(){
|
||||
local SUCCESS_MESSAGE="The command worked"
|
||||
local SUCCESS_TITLE="Success"
|
||||
local FAILURE_MESSAGE="The command failed"
|
||||
local FAILURE_TITLE="Failed"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
|
||||
osascript -e "display notification \"$SUCCESS_MESSAGE\" with title \"$SUCCESS_TITLE\""
|
||||
else
|
||||
|
||||
osascript -e "display notification \"$FAILURE_MESSAGE\" with title \"$FAILURE_TITLE\""
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
alias hermes-kanban="hermes dashboard --port 9229 --skip-build --host 127.0.0.1"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user