Pacman

Welcome to the Pacman bug tracker. Please search the current bugs and feature requests before filing a new one! Use advanced search and select "Search in Comments".

* Please select the correct category and version.
* Write a descriptive summary, background info, and provide a reproducible test case whenever possible.
Tasklist

FS#70227 - Pacman, do not dump description command line argument for sync and query search

Attached to Project: Pacman
Opened by Ahmet OZKESEK (aozkesek) - Tuesday, 30 March 2021, 10:50 GMT
Last edited by Doug Newgard (Scimmia) - Tuesday, 30 March 2021, 11:54 GMT
Task Type Feature Request
Category Packages: Core
Status Unconfirmed
Assigned To No-one
Architecture All
Severity Very Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

Hi,

First of all, thank you for great and more importantly up-to-date Arch Linux.

Would it not be nice if a command line argument like --nodesc for "pacman -S -s"
and "pacman -Q -s" to not to dump package description? I would rather to see
less output, sometimes just the [name,version].

I am using my hacked version of pacman by the way, to get the result that I want.
So feel free to ignore this feature-request for other user's sake.

The changes I did in my version of pacman are like this;

---
src/pacman/conf.h | 8 +++++++-
src/pacman/package.c | 15 ++++++++++++---
src/pacman/pacman.c | 11 +++++++++++
3 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/src/pacman/conf.h b/src/pacman/conf.h
index 1b9fb337..7c0401b8 100644
--- a/src/pacman/conf.h
+++ b/src/pacman/conf.h
@@ -51,6 +51,8 @@ typedef struct __config_t {
unsigned short help;
unsigned short noconfirm;
unsigned short noprogressbar;
+ unsigned short nodesc;
+ unsigned short notinstalled;
unsigned short logmask;
unsigned short print;
unsigned short checkspace;
@@ -213,7 +215,11 @@ enum {
OP_DOWNLOADONLY,
OP_REFRESH,
OP_ASSUMEINSTALLED,
- OP_DISABLEDLTIMEOUT
+ OP_DISABLEDLTIMEOUT,
+ /* OP_NODESC: do not dump the description */
+ OP_NODESC,
+ /* OP_NOTINSTALLED: do not dump the installed packages */
+ OP_NOTINSTALLED
};

/* clean method */
diff --git a/src/pacman/package.c b/src/pacman/package.c
index eaee3bb0..fcf7ca82 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -553,6 +553,13 @@ int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status)
if(config->quiet) {
fputs(alpm_pkg_get_name(pkg), stdout);
} else {
+
+ if (config->notinstalled == 1) {
+ if (alpm_db_get_pkg(db_local, alpm_pkg_get_name(pkg))) {
+ continue;
+ }
+ }
+
printf("%s%s/%s%s %s%s%s", colstr->repo, alpm_db_get_name(db),
colstr->title, alpm_pkg_get_name(pkg),
colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor);
@@ -562,9 +569,11 @@ int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status)
print_installed(db_local, pkg);
}

- /* we need a newline and initial indent first */
- fputs("\n ", stdout);
- indentprint(alpm_pkg_get_desc(pkg), 4, cols);
+ if (config->nodesc == 0) {
+ /* we need a newline and initial indent first */
+ fputs("\n ", stdout);
+ indentprint(alpm_pkg_get_desc(pkg), 4, cols);
+ }
}
fputc('\n', stdout);
}
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index b2aabc08..a53dd00b 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -571,6 +571,9 @@ static int parsearg_query(int opt)
case 'u':
config->op_q_upgrade = 1;
break;
+ case OP_NODESC:
+ config->nodesc = 1;
+ break;
default:
return 1;
}
@@ -830,6 +833,12 @@ static int parsearg_sync(int opt)
case 'y':
(config->op_s_sync)++;
break;
+ case OP_NODESC:
+ config->nodesc = 1;
+ break;
+ case OP_NOTINSTALLED:
+ config->notinstalled = 1;
+ break;
default:
return 1;
}
@@ -946,6 +955,8 @@ static int parseargs(int argc, char *argv[])
{"dbonly", no_argument, 0, OP_DBONLY},
{"color", required_argument, 0, OP_COLOR},
{"disable-download-timeout", no_argument, 0, OP_DISABLEDLTIMEOUT},
+ {"nodesc", no_argument, 0, OP_NODESC},
+ {"notinstalled", no_argument, 0, OP_NOTINSTALLED},
{0, 0, 0, 0}
};
This task depends upon

Comment by Allan McRae (Allan) - Tuesday, 30 March 2021, 11:07 GMT
I will not accept this patch. The approach that needs to be taken is to extend --print-format to be available for more options and to be more flexible in terms of what it can output.
Comment by Ahmet OZKESEK (aozkesek) - Tuesday, 30 March 2021, 11:47 GMT
Hi Allan, Thank you for your comment.

I played a bit print & print-format, pacman -Sp zip --print-format "%n %v" which is nice though, they do not change the output of sync-search and query, do they?
So we still see same output for both pacman -Sps zip --print-format "%n %v" and pacman -Ss zip.

Anyway, thank you for your time, once again.
Comment by Allan McRae (Allan) - Tuesday, 30 March 2021, 13:20 GMT
--print-format does not change the output of -Ss and -Qs. My point was we already have that option and so the solution to this issue is to extend its use into these options.
Comment by Ahmet OZKESEK (aozkesek) - Tuesday, 30 March 2021, 13:39 GMT
it is absolutely clear for me now, sory for noise. thanks Allan.

Loading...