shift opts, add output and source dir
This commit is contained in:
parent
1e17c19038
commit
9938a57ebb
24
mkshare
24
mkshare
|
@ -2,9 +2,8 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
BASE="$0"
|
output_dir=""
|
||||||
SHARE_DIR=""
|
source_dir=""
|
||||||
SOURCE_DIR=""
|
|
||||||
|
|
||||||
compress="false"
|
compress="false"
|
||||||
expire="false"
|
expire="false"
|
||||||
|
@ -29,17 +28,10 @@ common options:
|
||||||
[ $# -eq 0 ] && print_usage && exit 1
|
[ $# -eq 0 ] && print_usage && exit 1
|
||||||
|
|
||||||
# parse flags
|
# parse flags
|
||||||
# c: compress
|
# s: shorten (optional)
|
||||||
# use zip to compress files or directories and put link to created zip file
|
|
||||||
# e: expire
|
|
||||||
# use ISO-8061 datetime string to set expiry date
|
|
||||||
# default expiry date is 7 days from creation
|
|
||||||
# h: help
|
|
||||||
# print usage
|
|
||||||
# s: shorten
|
|
||||||
# generate random string of characters using `head /dev/urandom | tr -dc A-Za-z0-9 | head -c16`
|
# generate random string of characters using `head /dev/urandom | tr -dc A-Za-z0-9 | head -c16`
|
||||||
|
|
||||||
while getopts ':cehs' flag; do
|
while getopts 'cehso:d' flag; do
|
||||||
case "$flag" in
|
case "$flag" in
|
||||||
h) print_usage ;;
|
h) print_usage ;;
|
||||||
c)
|
c)
|
||||||
|
@ -62,6 +54,14 @@ while getopts ':cehs' flag; do
|
||||||
s)
|
s)
|
||||||
shorten="true"
|
shorten="true"
|
||||||
;;
|
;;
|
||||||
|
o)
|
||||||
|
# NEEDS REALPATH VERIFICATION
|
||||||
|
output_dir="${OPTARG}"
|
||||||
|
;;
|
||||||
|
d)
|
||||||
|
# NEEDS REALPATH VERIFICATION
|
||||||
|
source_dir="${OPTARG}"
|
||||||
|
;;
|
||||||
?)
|
?)
|
||||||
echo "Invalid option: -${OPTARG}"
|
echo "Invalid option: -${OPTARG}"
|
||||||
echo
|
echo
|
||||||
|
|
Loading…
Reference in New Issue