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: Sun, 20 Dec 2015 00:17:38 +0000 (UTC)	[thread overview]
Message-ID: <1450570007.a3091c3b9dcae38cc1b6a78f8f963e2cbc3144be.mjo@gentoo> (raw)

commit:     a3091c3b9dcae38cc1b6a78f8f963e2cbc3144be
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 20 00:06:47 2015 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sun Dec 20 00:06:47 2015 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=a3091c3b

Consolidate all list_foo actions into one new list_sapi() function.

This follows in the same vein as the other recent refactorings. With
the machinery in place, list_cli, list_cgi, etc. are all replaced by
one function list_sapi() taking a SAPI name as an argument.

 src/php.eselect.in | 70 +++++++++++++++++++-----------------------------------
 1 file changed, 24 insertions(+), 46 deletions(-)

diff --git a/src/php.eselect.in b/src/php.eselect.in
index a377116..9a1d628 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -249,69 +249,47 @@ check_module() {
 
 ## Actual actions
 
-list_apache2() {
-	local targets
-	local a
-	targets=( $(find_sapi_targets apache2) )
-	a=$(get_sapi_active_target apache2)
+# Perform the "list" action for the given SAPI.
+#
+# INPUT:
+#
+# The SAPI name.
+#
+# OUTPUT:
+#
+# A numbered and decorated list of targets for the given SAPI.
+#
+list_sapi() {
+	local sapi="${1}"
+	local targets=( $(find_sapi_targets "${sapi}") )
+	local active=$(get_sapi_active_target "${sapi}")
+
 	for (( i = 0; i < ${#targets[@]}; i++ )) ; do
-		if [[ $a == ${targets[i]} ]] ; then
+		if [[ $active == ${targets[i]} ]] ; then
 			targets[i]=$(highlight_marker "${targets[i]}")
 		fi
 	done
 	write_numbered_list -m "(none found)" "${targets[@]}"
 }
 
+list_apache2() {
+	list_sapi apache2
+}
+
 list_cli() {
-	local targets
-	local a
-	targets=( $(find_sapi_targets cli) )
-	a=$(get_sapi_active_target cli)
-	for (( i = 0; i < ${#targets[@]}; i++ )) ; do
-		if [[ $a == ${targets[i]} ]] ; then
-			targets[i]=$(highlight_marker "${targets[i]}")
-		fi
-	done
-	write_numbered_list -m "(none found)" "${targets[@]}"
+	list_sapi cli
 }
 
 list_cgi() {
-	local targets
-	local a
-	targets=( $(find_sapi_targets cgi) )
-	a=$(get_sapi_active_target cgi)
-	for (( i = 0; i < ${#targets[@]}; i++ )) ; do
-		if [[ $a == ${targets[i]} ]] ; then
-			targets[i]=$(highlight_marker "${targets[i]}")
-		fi
-	done
-	write_numbered_list -m "(none found)" "${targets[@]}"
+	list_sapi cgi
 }
 
 list_fpm() {
-	local targets
-	local a
-	targets=( $(find_sapi_targets fpm) )
-	a=$(get_sapi_active_target fpm)
-	for (( i = 0; i < ${#targets[@]}; i++ )) ; do
-		if [[ $a == ${targets[i]} ]] ; then
-			targets[i]=$(highlight_marker "${targets[i]}")
-		fi
-	done
-	write_numbered_list -m "(none found)" "${targets[@]}"
+	list_sapi fpm
 }
 
 list_phpdbg() {
-	local targets
-	local a
-	targets=( $(find_sapi_targets dbg) )
-	a=$(get_sapi_active_target dbg)
-	for (( i = 0; i < ${#targets[@]}; i++ )) ; do
-		if [[ $a == ${targets[i]} ]] ; then
-			targets[i]=$(highlight_marker "${targets[i]}")
-		fi
-	done
-	write_numbered_list -m "(none found)" "${targets[@]}"
+	list_sapi dbg
 }
 
 set_apache2() {


             reply	other threads:[~2015-12-20  0:17 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-20  0:17 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
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-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=1450570007.a3091c3b9dcae38cc1b6a78f8f963e2cbc3144be.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