-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_functions
58 lines (43 loc) · 1.08 KB
/
.bash_functions
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
#
# Functions for sharing during loading of aliases.
function alias-update() {
touch "${UPDATE_MARKER_FILE}"
if [ -f "${HOME}/.bash_profile" ]; then
# shellcheck source=/dev/null
source "${HOME}/.bash_profile"
else
# shellcheck source=/dev/null
source "${HOME}/.bashrc"
fi
}
function alias-pull() {
pushd "${BASH_ALIAS_SYNC_REPO}" > /dev/null || return 2
git pull --rebase --autostash
alias-update
popd > /dev/null || return 2
}
function alias-push() {
pushd "${BASH_ALIAS_SYNC_REPO}" > /dev/null || return 2
git pull --rebase --autostash
git add -A
git commit -m "Change aliases"
git push
alias-update
popd > /dev/null || return 2
}
function alias-reset() {
pushd "${BASH_ALIAS_SYNC_REPO}" > /dev/null || return 2
git reset --hard
git clean -fd
alias-update
popd > /dev/null || return 2
}
function alias-edit() {
code "${BASH_ALIAS_SYNC_REPO}" --new-window
}
function alias-deps-lock-rm() {
pushd "${BASH_ALIAS_SYNC_REPO}" > /dev/null || return 2
git clean -fdx "**/.bash_deps.lock"
popd > /dev/null || return 2
}