-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.functions
More file actions
40 lines (36 loc) · 928 Bytes
/
Copy path.functions
File metadata and controls
40 lines (36 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function mkcd() {
mkdir -p "$@" && cd "$_";
}
# `o` with no arguments opens the current directory, otherwise opens the given
# location
function o() {
if [ $# -eq 0 ]; then
open .;
else
open "$@";
fi;
}
# `tre` is a shorthand for `tree` with hidden files and color enabled, ignoring
# the `.git` directory, listing directories first. The output gets piped into
# `less` with options to preserve color and line numbers, unless the output is
# small enough for one screen.
function tre() {
tree -aC -I '.git|node_modules' --dirsfirst "$@" | less -FRNX;
}
# Function to add files, commit, and push (acp) to github
function git-acp() {
git add .
if [[ -n $1 ]]; then
git commit -m "$1"
else
git commit -m "update"
fi
git push
}
function alert() {
if [[ -n $2 ]]; then
osascript -e "display notification \"$1\" with title \"$2\""
else
osascript -e "display notification \"$1\" with title \"Alert\""
fi
}