public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michael Orlitzky" <mjo@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/eselect-php:master commit in: src/
Date: Fri,  8 Jan 2016 21:50:23 +0000 (UTC)	[thread overview]
Message-ID: <1452270750.e05ad5dc17a9501bf14e56652a42cf66a545e512.mjo@gentoo> (raw)

commit:     e05ad5dc17a9501bf14e56652a42cf66a545e512
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan  8 16:32:30 2016 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan  8 16:32:30 2016 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=e05ad5dc

Document and clean up the resolv_target function.

 src/php.eselect.in | 39 +++++++++++++++++++++++++++++++++------
 1 file changed, 33 insertions(+), 6 deletions(-)

diff --git a/src/php.eselect.in b/src/php.eselect.in
index d868082..72e6610 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -231,14 +231,41 @@ write_mod_php_conf() {
 	EOF
 }
 
+
+# Resolve an index or target name for a given SAPI into the "display
+# name" of that target.
+#
+# INPUT:
+#
+# The first parameter is the name of a SAPI. The second parameter is
+# either a number (the index of a target), or a target name.
+#
+# OUTPUT:
+#
+# The "display name" of the given target for the given SAPI. For
+# example, if the first parameter is "cli" and the second parameter is
+# "1", then the output will be the display name of the first target
+# for the cli SAPI (e.g. "php5.6").
+#
+# If the index or target name is invalid (that is, does not correspond
+# to one of the valid targets for the given SAPI), then nothing is
+# output.
+#
 resolv_target() {
-	local targets=( $(find_sapi_targets $1) )
-	if is_number $2; then
-		if [[ $2 -le ${#targets[@]} && $2 -gt 0 ]] ; then
-			echo "${targets[ $(( $2 - 1 )) ]}"
+	local sapi="${1}"
+	local target="${2}"
+
+	# $targets is an array of things like "php5.6" and "php7.0"
+	local targets=( $(find_sapi_targets "${sapi}") )
+
+	if is_number "${target}" ; then
+		if [[ $target -le ${#targets[@]} && $target -gt 0 ]] ; then
+			# $target looks like an index into the $targets array.
+			echo "${targets[ $(( $target - 1 )) ]}"
 		fi
-	elif has $2 ${targets[@]}; then
-	  echo $2
+	elif has "${target}" ${targets[@]} ; then
+		# $target is the *name* of a valid target for this SAPI.
+		echo "${target}"
 	fi
 }
 


             reply	other threads:[~2016-01-08 21:50 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08 21:50 Michael Orlitzky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-12-08  2:24 [gentoo-commits] proj/eselect-php:master commit in: src/ Brian Evans
2020-03-01 12:59 Michael Orlitzky
2020-02-29 22:16 Michael Orlitzky
2020-02-29 22:16 Michael Orlitzky
2020-02-29 22:16 Michael Orlitzky
2020-02-29 22:16 Michael Orlitzky
2020-02-12 22:30 Michael Orlitzky
2018-04-12  2:24 Michael Orlitzky
2016-01-22 20:53 Michael Orlitzky
2016-01-22 19:42 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22  3:15 Michael Orlitzky
2016-01-22  3:15 Michael Orlitzky
2016-01-22  3:15 Michael Orlitzky
2016-01-22  3:15 Michael Orlitzky
2016-01-20 14:42 Michael Orlitzky
2016-01-09 17:20 Michael Orlitzky
2016-01-09 17:20 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-18  2:27 Brian Evans
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky

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=1452270750.e05ad5dc17a9501bf14e56652a42cf66a545e512.mjo@gentoo \
    --to=mjo@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