mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
p2v: Implement --short-options and --long-options in virt-p2v-make-* scripts.
This commit is contained in:
@@ -36,9 +36,11 @@ else
|
||||
fi
|
||||
|
||||
# Parse the command line arguments.
|
||||
shortopts=o:vV
|
||||
longopts=arch:,help,short-options,inject-ssh-identity:,install:,long-options,no-warn-if-partition,output:,verbose,version
|
||||
TEMP=`getopt \
|
||||
-o o:vV \
|
||||
--long arch:,help,inject-ssh-identity:,install:,no-warn-if-partition,output:,verbose,version \
|
||||
-o "$shortopts" \
|
||||
--long "$longopts" \
|
||||
-n $program -- "$@"`
|
||||
if [ $? != 0 ]; then
|
||||
echo "$program: problem parsing the command line arguments"
|
||||
@@ -92,6 +94,15 @@ while true; do
|
||||
-V|--version)
|
||||
echo "$program $version"
|
||||
exit 0;;
|
||||
--short-options)
|
||||
echo -n "$shortopts" |
|
||||
@SED@ -e 's/://g' -e 's/\(.\)/-\1\n/g'
|
||||
exit 0;;
|
||||
--long-options)
|
||||
echo "$longopts" |
|
||||
@SED@ -e 's/,/\n/g' -e 's/:$//mg' -e 's/\(.*\)/--\1/mg' |
|
||||
grep -v -E -- "--(short|long)-options"
|
||||
exit 0;;
|
||||
--)
|
||||
shift
|
||||
break;;
|
||||
|
||||
@@ -22,9 +22,12 @@ unset CDPATH
|
||||
program="virt-p2v-make-kickstart"
|
||||
version="@PACKAGE_VERSION@"
|
||||
|
||||
# Parse the command line arguments.
|
||||
shortopts=o:vV
|
||||
longopts=help,inject-ssh-identity:,install:,long-options,output:,proxy:,short-options,verbose,version
|
||||
TEMP=`getopt \
|
||||
-o o:vV \
|
||||
--long help,inject-ssh-identity:,install:,output:,proxy:,verbose,version \
|
||||
-o "$shortopts" \
|
||||
--long "$longopts" \
|
||||
-n $program -- "$@"`
|
||||
if [ $? != 0 ]; then
|
||||
echo "$program: problem parsing the command line arguments"
|
||||
@@ -68,11 +71,22 @@ while true; do
|
||||
set +x
|
||||
verbose=1
|
||||
shift;;
|
||||
|
||||
# help etc.
|
||||
--help)
|
||||
usage 0;;
|
||||
-V|--version)
|
||||
echo "$program $version"
|
||||
exit 0;;
|
||||
--help)
|
||||
usage 0;;
|
||||
--short-options)
|
||||
echo -n "$shortopts" |
|
||||
@SED@ -e 's/://g' -e 's/\(.\)/-\1\n/g'
|
||||
exit 0;;
|
||||
--long-options)
|
||||
echo "$longopts" |
|
||||
@SED@ -e 's/,/\n/g' -e 's/:$//mg' -e 's/\(.*\)/--\1/mg' |
|
||||
grep -v -E -- "--(short|long)-options"
|
||||
exit 0;;
|
||||
--)
|
||||
shift
|
||||
break;;
|
||||
|
||||
@@ -22,9 +22,12 @@ unset CDPATH
|
||||
program="virt-p2v-make-kiwi"
|
||||
version="@PACKAGE_VERSION@"
|
||||
|
||||
# Parse the command line arguments.
|
||||
shortopts=o:V
|
||||
longopts=help,inject-ssh-identity:,long-options,output:,short-options,version
|
||||
TEMP=`getopt \
|
||||
-o o:V \
|
||||
--long help,inject-ssh-identity:,output:,version \
|
||||
-o "$shortopts" \
|
||||
--long "$longopts" \
|
||||
-n $program -- "$@"`
|
||||
if [ $? != 0 ]; then
|
||||
echo "$program: problem parsing the command line arguments"
|
||||
@@ -52,11 +55,22 @@ while true; do
|
||||
-o|--output)
|
||||
output="$2"
|
||||
shift 2;;
|
||||
|
||||
# help etc.
|
||||
--help)
|
||||
usage 0;;
|
||||
-V|--version)
|
||||
echo "$program $version"
|
||||
exit 0;;
|
||||
--help)
|
||||
usage 0;;
|
||||
--short-options)
|
||||
echo -n "$shortopts" |
|
||||
@SED@ -e 's/://g' -e 's/\(.\)/-\1\n/g'
|
||||
exit 0;;
|
||||
--long-options)
|
||||
echo "$longopts" |
|
||||
@SED@ -e 's/,/\n/g' -e 's/:$//mg' -e 's/\(.*\)/--\1/mg' |
|
||||
grep -v -E -- "--(short|long)-options"
|
||||
exit 0;;
|
||||
--)
|
||||
shift
|
||||
break;;
|
||||
|
||||
Reference in New Issue
Block a user