From ebe04d88b00a9ed8f469bd76e2161e3bbd3d9a18 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Sun, 24 Apr 2011 16:01:42 +0200 Subject: [PATCH] Exit 0 when showing help, and support -h. --- debian/changelog | 1 + mk-sbuild | 11 +++++++---- ubuntutools/test/test_help.py | 1 - 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index a0e05f2..0dc02e0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ ubuntu-dev-tools (0.123) UNRELEASED; urgency=low * mk-sbuild: - Disable daemons with a policy-rc.d script (like pbuilder does) - Move package installation after option parsing. + - Exit 0 when showing help, and support -h. -- Stefano Rivera Sun, 24 Apr 2011 12:45:31 +0200 diff --git a/mk-sbuild b/mk-sbuild index f8714ac..4bf14cf 100755 --- a/mk-sbuild +++ b/mk-sbuild @@ -70,14 +70,17 @@ function usage() echo " DEBOOTSTRAP_EXCLUDE Excluded packages (same as --debootstrap-exclude)" echo " TEMPLATE_SOURCES A template for sources.list" echo " TEMPLATE_SCHROOTCONF A template for schroot.conf stanza" - exit 1 + if [ -z "$1" ]; then + exit 1 + fi + exit $1 } if [ -z "$1" ]; then usage fi -OPTS=`getopt -o '' --long "help,debug,skip-updates,arch:,name:,source-template:,debootstrap-mirror:,debootstrap-include:,debootstrap-exclude:,personality:,distro:,vg:,type:" -- "$@"` +OPTS=`getopt -o 'h' --long "help,debug,skip-updates,arch:,name:,source-template:,debootstrap-mirror:,debootstrap-include:,debootstrap-exclude:,personality:,distro:,vg:,type:" -- "$@"` eval set -- "$OPTS" VG="" @@ -145,8 +148,8 @@ while :; do shift break ;; - --help|*) - usage + -h|--help|*) + usage 0 ;; esac done diff --git a/ubuntutools/test/test_help.py b/ubuntutools/test/test_help.py index d405d17..485846b 100644 --- a/ubuntutools/test/test_help.py +++ b/ubuntutools/test/test_help.py @@ -32,7 +32,6 @@ BLACKLIST = { 'grep-merges': 'No Help', 'lp-project-upload': 'Returns non-zero after help. ' 'Leaving u-d-t in LP: #524680', - 'mk-sbuild': 'Fires up apt-get before showing help', 'pbuilder-dist-simple': 'No Help', 'setup-packaging-environment': 'Throws Error', 'submittodebian': 'No Help',