commit: 5d2ac3cb2c355d48388453ecfcb2a548b0b74c26
parent: 4cad8325b8221097c8ecacd5f0f9fd8e2842acad
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sat, 5 May 2018 06:46:20 +0200
sshpaste: Add the -h option to show usage
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/sshpaste b/sshpaste
@@ -47,16 +47,17 @@ sshpaste_command() {
}
sshpaste_usage() {
- echo "Usage: ${1} [option] [file(s)]" >&2
+ echo "Usage: ${1} [options] [file(s)]" >&2
echo 'Options:' >&2
echo ' -c COMMAND paste COMMAND and the output of COMMAND' >&2
+ echo ' -h show this help' >&2
echo ' -x read input from clipboard (requires xclip)' >&2
}
flag_x=
temporary_file=
-while getopts "xc:" opt
+while getopts "xhc:" opt
do
case $opt in
'c')
@@ -65,6 +66,10 @@ do
flag_c=1
opt_command="${OPTARG}"
;;
+ 'h')
+ sshpaste_usage $0
+ exit 0
+ ;;
'x')
[ -z flag_c ] && die "Cannot have both -x and -c"
flag_x=1