You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tmux-hints.sh
+46-8Lines changed: 46 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -14,14 +14,55 @@
14
14
# though loads of txt/md notes.
15
15
#
16
16
17
+
export PATH=/usr/local/bin:/bin:/usr/bin
18
+
tag=${0##*/}
19
+
20
+
say () { echo"$tag: $@"; }
21
+
die () { say "FATAL: $@";exit 1; }
22
+
23
+
# sanity check
24
+
case"$TMUX"in
25
+
"") die "You need to be running tmux to use tmux-hints!" ;;
26
+
*) ;;
27
+
esac
28
+
29
+
30
+
header_init="# $tag\n"
31
+
17
32
viewer="cat"
18
33
extension=".txt"
19
34
hint_path="$HOME/hints/"
20
35
verbose=false
21
36
quiet=false
22
-
header_init="# tmux-hints.sh\n"
23
37
repo="https://github.com/hozza/tmux-hints"
24
-
version="0.2"
38
+
version="0.3"
39
+
40
+
# help doc
41
+
help () {
42
+
echo -e "$header_init"
43
+
44
+
cat <<EndHelp
45
+
$tag version $version usage:
46
+
47
+
Synopsis:
48
+
49
+
$tag [SHORT-OPTION]
50
+
51
+
Option [default] Description:
52
+
53
+
-h this help text
54
+
-o [cat] hint file opener e.g. less|markdown
55
+
-p [$HOME/hints/] /path/to/hint/files/
56
+
-q quiet mode, hint only
57
+
-v verbose
58
+
-x [txt] hint file extension
59
+
60
+
By default, it will try to cat $HOME/hints/tmux.txt, make sure this exists! :)
61
+
For more help visit $repo
62
+
EndHelp
63
+
}
64
+
65
+
25
66
26
67
whilegetopts'o:x:p:vhq' flag;do
27
68
case"${flag}"in
@@ -30,10 +71,7 @@ while getopts 'o:x:p:vhq' flag; do
30
71
p) hint_path="${OPTARG}" ;;
31
72
v) verbose=true ;;
32
73
q) quiet=true ;;
33
-
h)
34
-
echo -e "$header_init\ntmux-hints.sh version $version Usage:\n\nSynopsis:\n\n\ttmux-hints.sh [SHORT-OPTION]\n\nOption [default] Description:\n\n\t-o\t[cat] hint file opener e.g. less|markdown\n\t-x\t[txt] hint file extension\n\t-p\t[$HOME/hints/] /path/to/hint/files/\n\t-v\tverbose\n\t-q\tquiet mode, hint only\n\t-h\tthis help text\n\nFor more help visit the repo: $repo"
35
-
exit 2
36
-
;;
74
+
h) help;exit 2 ;;
37
75
*) break ;;
38
76
esac
39
77
done
@@ -47,10 +85,10 @@ tmux set-option focus-events on
default="\nCreate a default hint file:\n\n"$hint_path"default"$extension"\n\nExit:\tCtrl+c\n\nUpdate:\t'git pull' in tmux-hint directory.\n\nHelp:\ttmux-hints.sh -h\n\nRepo:\t$repo\n"
91
+
default="\nCreate a default hint file:\n\n"$hint_path"tmux"$extension"\n\nExit:\tCtrl+c\n\nUpdate:\t'git pull' in tmux-hint directory.\n\nHelp:\ttmux-hints.sh -h\n\nRepo:\t$repo\n"
0 commit comments