Skip to content

Commit b79045f

Browse files
committed
feat: add version() and usage()
1 parent f5da511 commit b79045f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tusc.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,38 @@
88
# Be sure to check readme doc at https://github.com/adhocore/bash-tus
99
#
1010

11+
FULL=`readlink -f $0` # fullpath
12+
TUSC=`basename $0` # name
13+
1114
# message helpers
1215
line() { echo -e "\e[${3:-0};$2m$1\e[0m"; }
1316
error() { line "$1" 31; if [[ ! ${2:-0} -eq 0 ]]; then exit $2; fi }
1417
ok() { line "${1:- Done}" 32; }
1518
info() { line "$1" 33; }
1619
comment() { line "$1" 30 1; }
20+
21+
# show version
22+
version() { echo v0.0.1; }
23+
24+
# show usage
25+
usage()
26+
{
27+
cat << USAGE
28+
$TUSC $(info `version`) | $(ok "(c) Jitendra Adhikari")
29+
$TUSC is bash implementation of tus-client (https://tus.io).
30+
$(ok Usage:)
31+
$TUSC <--options>
32+
$TUSC <host> <file> [algo]
33+
$(ok Options:)
34+
$(info "-a --algo") $(comment "The algorigthm for key &/or checksum.")
35+
$(comment "(Eg: sha1, sha256)")
36+
$(info "-f --file") $(comment "The file to upload.")
37+
$(info "-h --help") $(comment "Show help information and usage.")
38+
$(info "-H --host") $(comment "The tus-server host where file is uploaded.")
39+
$(ok Examples:)
40+
$TUSC
41+
$TUSC version $(comment "# prints current version of itself")
42+
$TUSC --help $(comment "# shows this help")
43+
USAGE
44+
exit 0
45+
}

0 commit comments

Comments
 (0)