File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 3636set -o errexit
3737set -o nounset
3838
39- usage= " USAGE: docker2singularity [-m \" /mount_point1 /mount_point2 \" ] [options] docker_image_name "
39+ function usage() {
4040
41- # --- Option processing --------------------------------------------
42- if [ $# == 0 ] ; then
43- echo " ${usage} "
41+ echo " USAGE: docker2singularity [-m \" /mount_point1 /mount_point2\" ] [options] docker_image_name"
42+ echo " "
4443 echo " OPTIONS:
4544
4645 Image Format
@@ -51,7 +50,11 @@ if [ $# == 0 ] ; then
5150 --mount -m provide list of custom mount points (in quotes!)
5251 --help -h show this help and exit
5352 "
53+ }
5454
55+ # --- Option processing --------------------------------------------
56+ if [ $# == 0 ] ; then
57+ usage
5558 exit 1;
5659fi
5760
@@ -62,7 +65,8 @@ new_container_name=""
6265while true ; do
6366 case ${1:- } in
6467 -h|--help|help)
65- echo " ${usage} "
68+ usage
69+ usage
6670 exit 0
6771 ;;
6872 -n|--name)
@@ -86,16 +90,16 @@ while true; do
8690 shift
8791 ;;
8892 :) printf " missing argument for -%s\n" " $option " >&2
89- echo " $ usage" >&2
93+ usage
9094 exit 1
9195 ;;
9296 \? ) printf " illegal option: -%s\n" " $option " >&2
93- echo " $ usage" >&2
97+ usage
9498 exit 1
9599 ;;
96100 -* )
97101 printf " illegal option: -%s\n" " $option " >&2
98- echo " $ usage" >&2
102+ usage
99103 exit 1
100104 ;;
101105 * )
You can’t perform that action at this time.
0 commit comments