1
0
mirror of https://tildegit.org/tomasino/pb.git synced 2024-11-20 03:25:54 +01:00

option errors show usage

This commit is contained in:
James Tomasino 2020-06-10 22:36:56 +00:00
parent 2a8915fc3f
commit 43cc89a39c
3 changed files with 14 additions and 6 deletions

View File

@ -1,4 +1,4 @@
pb ![calver](https://img.shields.io/badge/calver-2020.01.20-22bfda.svg?style=flat-square) ![status](https://img.shields.io/badge/status-working-green.svg?style=flat-square) ![license](https://img.shields.io/badge/license-GPL3-blue.svg?style=flat-square)
pb ![calver](https://img.shields.io/badge/calver-2020.06.10-22bfda.svg?style=flat-square) ![status](https://img.shields.io/badge/status-working-green.svg?style=flat-square) ![license](https://img.shields.io/badge/license-GPL3-blue.svg?style=flat-square)
------
**pb** is a helper utility for using 0x0 pastebin services

16
pb
View File

@ -1,9 +1,9 @@
#!/bin/sh
# init variables
version="v2020.01.20"
version="v2020.06.10"
ENDPOINT="https://ttm.sh"
flag_options="hvcufs::x"
flag_options=":hvcufs::x"
flag_version=0
flag_help=0
flag_file=0
@ -31,6 +31,12 @@ OPTIONAL FLAGS:
END
}
show_usage() {
cat > /dev/stdout << END
usage: pb [-hfvcux] [-s server_address] filename
END
}
# helper for program exit, supports error codes and messages
die () {
msg="$1"
@ -59,14 +65,16 @@ fi
# attempt to parse options or die
if ! parsed=$(getopt ${flag_options} "$@"); then
die "Invalid input" 2
printf "pb: unknown option\\n"
show_usage
exit 2
fi
# handle options
eval set -- "${parsed}"
while true; do
case "$1" in
-h)
-h|?)
flag_help=1
;;
-v)

2
pb.1
View File

@ -1,4 +1,4 @@
.TH PB 1 "20 January 2020" "v2020.01.20"
.TH PB 1 "10 June 2020" "v2020.06.10"
.SH NAME
pb \- a helper utility for using 0x0 pastebin services