public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Fabian Groffen" <grobian@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage-utils:master commit in: man/include/, /, man/
Date: Fri, 12 Apr 2019 18:50:42 +0000 (UTC)	[thread overview]
Message-ID: <1555094897.26397171ecf098661502d86f9c6cde45ec70d180.grobian@gentoo> (raw)

commit:     26397171ecf098661502d86f9c6cde45ec70d180
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 12 18:48:17 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Apr 12 18:48:17 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=26397171

qlist: change behaviour to use colours and no parenthesis

- in list mode, show colours by default (can be disabled in the
  normal way using -C)
- in USE-flag mode, don't output ( ) so the output is compatible with
  e.g. package.use

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 man/include/qlist.optdesc.yaml |  9 +++------
 man/qlist.1                    | 11 +++++------
 qlist.c                        | 31 ++++++++++++++++---------------
 3 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/man/include/qlist.optdesc.yaml b/man/include/qlist.optdesc.yaml
index 2b9299c..5fff904 100644
--- a/man/include/qlist.optdesc.yaml
+++ b/man/include/qlist.optdesc.yaml
@@ -16,9 +16,6 @@ columns: |
     space-separated columns.
 verbose: |
     When used with \fB\-I\fR, print the package version next to name.
-    When listing the package contents, a single \fB\-v\fR displays
-    symlinks with an arrow (\->) to their target.  Two or more \fB\-v\fR
-    adds colour to the entries and prints like \fB\-I\fR before the
-    listing.  Shows disabled USE-flags when used with \fB\-U\fR.
-quiet: |
-    Suppresses the parenthesis around the USE-flags when used with \fB\-U\fR.
+    When listing the package contents, \fB\-v\fR displays symlinks with
+    an arrow (\->) to their target.  Shows disabled USE-flags when used
+    with \fB\-U\fR.

diff --git a/man/qlist.1 b/man/qlist.1
index 4df7dab..0b16318 100644
--- a/man/qlist.1
+++ b/man/qlist.1
@@ -1,5 +1,5 @@
 .\" generated by mkman.py, please do NOT edit!
-.TH qlist "1" "Mar 2019" "Gentoo Foundation" "qlist"
+.TH qlist "1" "Apr 2019" "Gentoo Foundation" "qlist"
 .SH NAME
 qlist \- list files owned by pkgname
 .SH SYNOPSIS
@@ -57,13 +57,12 @@ Set the ROOT env var.
 .TP
 \fB\-v\fR, \fB\-\-verbose\fR
 When used with \fB\-I\fR, print the package version next to name.
-When listing the package contents, a single \fB\-v\fR displays
-symlinks with an arrow (\->) to their target.  Two or more \fB\-v\fR
-adds colour to the entries and prints like \fB\-I\fR before the
-listing.  Shows disabled USE-flags when used with \fB\-U\fR.
+When listing the package contents, \fB\-v\fR displays symlinks with
+an arrow (\->) to their target.  Shows disabled USE-flags when used
+with \fB\-U\fR.
 .TP
 \fB\-q\fR, \fB\-\-quiet\fR
-Suppresses the parenthesis around the USE-flags when used with \fB\-U\fR.
+Tighter output; suppress warnings.
 .TP
 \fB\-C\fR, \fB\-\-nocolor\fR
 Don't output color.

diff --git a/qlist.c b/qlist.c
index d46e0a6..313ff56 100644
--- a/qlist.c
+++ b/qlist.c
@@ -88,11 +88,11 @@ cmpstringp(const void *p1, const void *p2)
  * -redis -sasl (-selinux) -sqlite -srs -syslog" 0 KiB
  *
  * % qlist -IUv exim
- * mail-mta/exim-4.92 (-arc -dane -dcc dkim -dlfunc dmarc dnsdb -doc
+ * mail-mta/exim-4.92 -arc -dane -dcc dkim -dlfunc dmarc dnsdb -doc
  * -dovecot-sasl -dsn exiscan-acl -gnutls -idn ipv6 -ldap -libressl lmtp
  * maildir -mbx -mysql -nis pam -perl -pkcs11 -postgres prdr -proxy
  * -radius -redis -sasl -selinux spf -sqlite -srs ssl -syslog tcpd tpda
- * -X)
+ * -X
  */
 static char _umapstr_buf[BUFSIZ];
 static const char *
@@ -134,8 +134,7 @@ umapstr(char display, q_vdb_pkg_ctx *pkg_ctx)
 
 #define add_to_buf(fmt, Cb, use, Ce) \
 	bufp += snprintf(bufp, sizeof(_umapstr_buf) - (bufp - _umapstr_buf), \
-			" %s%s" fmt "%s", \
-			bufp == _umapstr_buf && !quiet ? "(" : "", Cb, use, Ce);
+			" %s" fmt "%s", Cb, use, Ce);
 
 	/* merge join, ensure inputs are sorted (Portage does this, but just
 	 * to be sure) */
@@ -163,9 +162,6 @@ umapstr(char display, q_vdb_pkg_ctx *pkg_ctx)
 		}
 	}
 
-	bufp += snprintf(bufp, sizeof(_umapstr_buf) - (bufp - _umapstr_buf),
-			"%s", bufp == _umapstr_buf || quiet ? "" : ")");
-
 	freeargv(iuse_argc, iuse_argv);
 	freeargv(use_argc, use_argv);
 	free(iuse);
@@ -352,7 +348,8 @@ qlist_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
 
 	/* see if this cat/pkg is requested */
 	for (i = optind; i < state->argc; ++i)
-		if (qlist_match(pkg_ctx, state->argv[i], &state->atoms[i - optind], state->exact))
+		if (qlist_match(pkg_ctx, state->argv[i],
+					&state->atoms[i - optind], state->exact))
 			break;
 	if ((i == state->argc) && (state->argc != optind))
 		return 0;
@@ -362,7 +359,8 @@ qlist_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
 		atom = (verbose ? NULL : atom_explode(pkgname));
 		if ((state->all + state->just_pkgname) < 2) {
 			if (state->show_slots && !pkg_ctx->slot) {
-				q_vdb_pkg_eat(pkg_ctx, "SLOT", &pkg_ctx->slot, &pkg_ctx->slot_len);
+				q_vdb_pkg_eat(pkg_ctx, "SLOT",
+						&pkg_ctx->slot, &pkg_ctx->slot_len);
 				/* chop off the subslot if desired */
 				if (state->show_slots == 1) {
 					char *s = strchr(pkg_ctx->slot, '/');
@@ -396,8 +394,9 @@ qlist_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
 			return 1;
 	}
 
-	if (verbose > 1)
-		printf("%s%s/%s%s%s\n%sCONTENTS%s:\n", BOLD, catname, BLUE, pkgname, NORM, DKBLUE, NORM);
+	if (verbose)
+		printf("%s%s/%s%s%s %sCONTENTS%s:\n",
+				BOLD, catname, BLUE, pkgname, NORM, DKBLUE, NORM);
 
 	fp = q_vdb_pkg_fopenat_ro(pkg_ctx, "CONTENTS");
 	if (fp == NULL)
@@ -420,18 +419,20 @@ qlist_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
 		switch (e->type) {
 			case CONTENTS_DIR:
 				if (state->show_dir)
-					printf("%s%s%s/\n", verbose > 1 ? YELLOW : "" , e->name, verbose > 1 ? NORM : "");
+					printf("%s%s%s/\n", YELLOW, e->name, NORM);
 				break;
 			case CONTENTS_OBJ:
 				if (state->show_obj)
-					printf("%s%s%s\n", verbose > 1 ? WHITE : "" , e->name, verbose > 1 ? NORM : "");
+					printf("%s%s%s\n", WHITE, e->name, NORM);
 				break;
 			case CONTENTS_SYM:
 				if (state->show_sym) {
 					if (verbose)
-						printf("%s%s -> %s%s\n", verbose > 1 ? CYAN : "", e->name, e->sym_target, NORM);
+						printf("%s%s%s -> %s%s%s\n",
+								CYAN, e->name, NORM,
+								CYAN, e->sym_target, NORM);
 					else
-						printf("%s\n", e->name);
+						printf("%s%s%s\n", CYAN, e->name, NORM);
 				}
 				break;
 		}


             reply	other threads:[~2019-04-12 18:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12 18:50 Fabian Groffen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-02-20 12:23 [gentoo-commits] proj/portage-utils:master commit in: man/include/, /, man/ Fabian Groffen
2019-12-27 16:57 Fabian Groffen
2019-06-19  7:31 Fabian Groffen
2018-04-12 19:33 Fabian Groffen
2018-04-03 15:21 Fabian Groffen

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=1555094897.26397171ecf098661502d86f9c6cde45ec70d180.grobian@gentoo \
    --to=grobian@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