File tree Expand file tree Collapse file tree 4 files changed +39
-7
lines changed Expand file tree Collapse file tree 4 files changed +39
-7
lines changed Original file line number Diff line number Diff line change 1+ * 2023-02-03, Version 1.8.0
2+ * Option to show the last log entries
13* 2022-08-31, Version 1.7.0
24 * Available space in %
35* 2022-08-17, Version 1.6.0
Original file line number Diff line number Diff line change 1- Available space in %
1+ Option to show the last log entries
Original file line number Diff line number Diff line change 1- 1.7 .0
1+ 1.8 .0
Original file line number Diff line number Diff line change 1212#
1313
1414# shellcheck disable=SC2034
15- VERSION=1.7 .0
15+ VERSION=1.8 .0
1616
1717export LC_ALL=C
1818
@@ -83,14 +83,44 @@ format_timespan() {
8383
8484}
8585
86+ usage () {
87+
88+ echo
89+ echo " Usage: tmstatus.sh [OPTIONS]"
90+ echo
91+ echo " Options:"
92+ # Delimiter at 78 chars ############################################################
93+ echo " -h,--help,-? This help message"
94+ echo " -l,--log [lines] Show the last log lines"
95+ echo
96+ echo " Report bugs to https://github.com/matteocorti/tmstatus.sh/issues"
97+ echo
98+
99+ exit
100+
101+ }
102+
86103COMMAND_LINE_ARGUMENTS=$*
87104
88105while true ; do
89106
90107 case " $1 " in
91- -l | --log)
92- SHOWLOG=1
93- shift
108+ -h | --help)
109+ usage
110+ ;;
111+ -l | --log)
112+ SHOWLOG=20
113+ if [ $# -gt 1 ]; then
114+ # shellcheck disable=SC2295
115+ if [ " ${2% ${2# ?} } " x = ' -x' ]; then
116+ shift
117+ else
118+ SHOWLOG=$2
119+ shift 2
120+ fi
121+ else
122+ shift
123+ fi
94124 ;;
95125 * )
96126 if [ -n " $1 " ]; then
@@ -380,7 +410,7 @@ if [ -n "${SHOWLOG}" ]; then
380410 -e ' s/\[//' |
381411 expand -t 27 |
382412 cut -c -" ${WIDTH} " |
383- tail -n 20
413+ tail -n " ${SHOWLOG} "
384414
385415 printf ' %.s-' $( seq 1 " $( tput cols) " )
386416 echo
You can’t perform that action at this time.
0 commit comments