From: "Ulrich Müller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/eselect:master commit in: /, bin/
Date: Thu, 5 Jun 2014 11:22:42 +0000 (UTC) [thread overview]
Message-ID: <1401966992.dc9fac81f559a79b660bccc89e105afb314dd3e0.ulm@gentoo> (raw)
commit: dc9fac81f559a79b660bccc89e105afb314dd3e0
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 5 11:16:32 2014 +0000
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Thu Jun 5 11:16:32 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/eselect.git;a=commit;h=dc9fac81
Always parse global options. Respect "--".
* bin/eselect.in: Parse global options even if we are invoked
as something-config or similar. Respect "--" to indicate end
of options.
---
ChangeLog | 6 ++++++
bin/eselect.in | 64 ++++++++++++++++++++++++++++++++--------------------------
2 files changed, 41 insertions(+), 29 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 03fe042..c3f0061 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-06-05 Ulrich Müller <ulm@gentoo.org>
+
+ * bin/eselect.in: Parse global options even if we are invoked
+ as something-config or similar. Respect "--" to indicate end
+ of options.
+
2014-05-24 Ulrich Müller <ulm@gentoo.org>
* configure.ac: Update version to 1.4.2.
diff --git a/bin/eselect.in b/bin/eselect.in
index 70e1c20..e2f29ea 100755
--- a/bin/eselect.in
+++ b/bin/eselect.in
@@ -126,34 +126,40 @@ if [[ -z ${action} ]]; then
unset binname prefix
fi
-if [[ -z ${action} ]] && [[ -n ${1##--} ]]; then
- while [[ ${1##--} != "$1" ]]; do
- case ${1##--} in
- brief)
- set_output_mode brief
- ;;
- colour=*|color=*|colour|color)
- # accept all arguments that are valid for ls or emerge
- case ${1#*=} in
- yes|y|always|force|$1) colour=yes ;;
- no|n|never|none) colour=no ;;
- auto|tty|if-tty) colour="" ;;
- *) die -q "Invalid argument for ${1%%=*} option" ;;
- esac
- ;;
- help|version)
- action=${1##--}
- ;;
- *)
- die -q "Unknown option $1"
- ;;
- esac
- shift
- done
- if [[ -z ${action} ]]; then
- action=$1
- shift
- fi
+# parse global options
+while [[ ${1##--} != "$1" ]]; do
+ case ${1##--} in
+ brief)
+ set_output_mode brief
+ ;;
+ colour=*|color=*|colour|color)
+ # accept all arguments that are valid for ls or emerge
+ case ${1#*=} in
+ yes|y|always|force|$1) colour=yes ;;
+ no|n|never|none) colour=no ;;
+ auto|tty|if-tty) colour="" ;;
+ *) die -q "Invalid argument for ${1%%=*} option" ;;
+ esac
+ ;;
+ help|version)
+ [[ -z ${action} ]] || die -q "Too many parameters"
+ action=${1##--}
+ ;;
+ "")
+ # -- indicates end of options
+ shift
+ break
+ ;;
+ *)
+ die -q "Unknown option $1"
+ ;;
+ esac
+ shift
+done
+
+if [[ -z ${action} && $# -gt 0 ]]; then
+ action=$1
+ shift
fi
# enable colour output and get width of terminal iff stdout is a tty
@@ -167,7 +173,7 @@ unset colour
if [[ -n ${action} ]]; then
if is_function "es_do_${action}"; then
- [[ $# -gt 0 ]] && die -q "Too many parameters"
+ [[ $# -eq 0 ]] || die -q "Too many parameters"
es_do_${action}
else
do_action "${action}" "$@"
next reply other threads:[~2014-06-05 11:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-05 11:22 Ulrich Müller [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-01-05 20:59 [gentoo-commits] proj/eselect:master commit in: /, bin/ Ulrich Müller
2023-06-07 8:50 [gentoo-commits] proj/eselect:master commit in: bin/, / Ulrich Müller
2023-06-12 16:24 ` [gentoo-commits] proj/eselect:master commit in: /, bin/ Ulrich Müller
2023-06-05 18:34 Ulrich Müller
2013-10-22 17:04 Ulrich Müller
2013-10-22 8:30 Ulrich Müller
2013-10-22 8:47 ` Ulrich Müller
2013-08-08 20:59 Ulrich Mueller
2012-09-15 20:35 Ulrich Mueller
2012-09-13 17:11 Ulrich Mueller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1401966992.dc9fac81f559a79b660bccc89e105afb314dd3e0.ulm@gentoo \
--to=ulm@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox