launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24238
[Merge] ~twom/launchpad:rocketfuel-take-username into launchpad:master
Tom Wardill has proposed merging ~twom/launchpad:rocketfuel-take-username into launchpad:master.
Commit message:
Use getopts to get launchpad user
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~twom/launchpad/+git/launchpad/+merge/377768
rocketfuel-setup gathers the launchpad username interactively, this makes it awkward to use in scripts.
Use getopts parsing to allow the username to be passed on the command line.
Preserve existing --no-workspace argument.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~twom/launchpad:rocketfuel-take-username into launchpad:master.
diff --git a/utilities/rocketfuel-setup b/utilities/rocketfuel-setup
index c9f22b4..93ab4c3 100755
--- a/utilities/rocketfuel-setup
+++ b/utilities/rocketfuel-setup
@@ -9,22 +9,32 @@
# load up Ubuntu release details so we know which repos to enable
source /etc/lsb-release
-DO_WORKSPACE=1
-for arg in "$@"; do
- if [ "$arg" == "--no-workspace" ]; then
- DO_WORKSPACE=0
- else
- echo Unrecognized argument: $arg >& 2
- exit 1;
- fi
-done
-# Establish LP username
-whoami=`whoami`
-printf "What is your Launchpad username? [$whoami] "
-read lpusername
+eval set -- "$(getopt -o '' -l no-workspace,lpusername -- "$@")" || { warn_getopt auth; return; }
+ while :; do
+ case $1 in
+ --no-workspace)
+ DO_WORKSPACE=0
+ shift
+ ;;
+ --lpusername)
+ shift; # The arg is next in position args
+ lpusername=$2
+ echo "Using username $lpusername for Launchpad";
+ ;;
+ --) shift; break ;;
+ *) warn_getopt auth; return ;;
+ esac
+ done
+
if [ -z ${lpusername} ]; then
- lpusername=${whoami}
+ # Establish LP username
+ whoami=`whoami`
+ printf "What is your Launchpad username? [$whoami] "
+ read lpusername
+ if [ -z ${lpusername} ]; then
+ lpusername=${whoami}
+ fi
fi
# Make sure you have all the needed virtual hosts