-
Notifications
You must be signed in to change notification settings - Fork 1
/
.bash_functions
71 lines (56 loc) · 1.66 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
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
set_window_title() {
export FORCED_WINDOW_TITLE="$@"
printf '\e]2;%s\a' "$@"
}
unset_window_title() {
unset FORCED_WINDOW_TITLE
printf '\e]2;%s\a' "${DEFAULT_WINDOW_TITLE:-${USERNAME}@${HOSTNAME} - $(pwd)}"
}
function is_win() {
case "$(uname -s)" in
CYGWIN*|MINGW*) return 0 ;;
*) return 1 ;;
esac
}
function home_path() {
is_win &&
echo "$USERPROFILE\\${1//\//\\}" ||
echo "$HOME/$1"
}
git-context-graph-page() {
local margin=8
local lines=$(( LINES - margin ))
git context-graph --first-parent --pretty=graph-dyn "-n${lines}" "$@" | head -n $lines
}
# shellcheck disable=SC2086
git-graph-status-page() {
local margin=12
local reset="\e[0m"
local grey="\033[0;90m"
#local status_options=""
local status_options="-s -b"
local status; status=$(git -c color.status=always status ${status_options})
local slines; slines=$(wc -l <<< "$status")
local minlines=10
local lines=$(( LINES - slines - margin ))
lines=$(( lines < minlines ? minlines : lines ))
local separator; separator="${grey}$(eval "printf -- '-%.s' {1..${COLUMNS}}")${reset}"
# clear -x
#echo -e "$separator"
echo
git context-graph --first-parent --pretty=graph-dyn "-n${lines}" "$@" | head -n ${lines}
echo
echo -e "$separator"
echo
echo "$status"
echo
}
################################################################################
# Laravel Homestead
homestead () {
( cd ~/www/Homestead && vagrant $* )
}
################################################################################
# Docker
source ~/.dotfiles/dockerize-clis/dockerize-clis.sh