Add version information and color to -Qg/-Sg/-Sgg output
The output format is now in line with other query operations such as -Sl and -Q. This makes the colored [installed] labels added in the previous commit less obtrusive. Signed-off-by: Taro Tanaka <mkrmdk@gmail.com>
This commit is contained in:
parent
b25152dd46
commit
553d0a1249
4 changed files with 25 additions and 14 deletions
|
@ -347,10 +347,10 @@ Query Options (apply to '-Q')[[QO]]
|
||||||
pacman's output is processed in a script. Search will only show package
|
pacman's output is processed in a script. Search will only show package
|
||||||
names and not version, group, and description information; owns will
|
names and not version, group, and description information; owns will
|
||||||
only show package names instead of "file is owned by pkg" messages; group
|
only show package names instead of "file is owned by pkg" messages; group
|
||||||
will only show package names and omit group names; list will only show
|
will only show package names and omit group names and package versions;
|
||||||
files and omit package names; check will only show pairs of package names
|
list will only show files and omit package names; check will only show
|
||||||
and missing files; a bare query will only show package names
|
pairs of package names and missing files; a bare query will only show
|
||||||
rather than names and versions.
|
package names rather than names and versions.
|
||||||
|
|
||||||
*-s, \--search* <regexp>::
|
*-s, \--search* <regexp>::
|
||||||
Search each locally-installed package for names or descriptions that
|
Search each locally-installed package for names or descriptions that
|
||||||
|
@ -430,7 +430,7 @@ linkman:pacman.conf[5].
|
||||||
pacman's output is processed in a script. Search will only show package
|
pacman's output is processed in a script. Search will only show package
|
||||||
names and not repository, version, group, and description information; list
|
names and not repository, version, group, and description information; list
|
||||||
will only show package names and omit databases and versions; group will
|
will only show package names and omit databases and versions; group will
|
||||||
only show package names and omit group names.
|
only show package names and omit group names and package versions.
|
||||||
|
|
||||||
*-s, \--search* <regexp>::
|
*-s, \--search* <regexp>::
|
||||||
This will search each package in the sync databases for names or
|
This will search each package in the sync databases for names or
|
||||||
|
|
|
@ -322,7 +322,7 @@ _pacman_completions_all_packages() {
|
||||||
_pacman_completions_installed_groups() {
|
_pacman_completions_installed_groups() {
|
||||||
local -a cmd groups
|
local -a cmd groups
|
||||||
_pacman_get_command
|
_pacman_get_command
|
||||||
groups=(${(o)${(f)"$(_call_program groups $cmd[@] -Qg)"}% *})
|
groups=(${(o)${(f)"$(_call_program groups $cmd[@] -Qg)"}%% *})
|
||||||
typeset -U groups
|
typeset -U groups
|
||||||
compadd "$@" -a groups
|
compadd "$@" -a groups
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,9 +352,10 @@ static int display(alpm_pkg_t *pkg)
|
||||||
static int query_group(alpm_list_t *targets)
|
static int query_group(alpm_list_t *targets)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *j;
|
alpm_list_t *i, *j;
|
||||||
|
alpm_db_t *db_local = alpm_get_localdb(config->handle);
|
||||||
|
const colstr_t *colstr = &config->colstr;
|
||||||
const char *grpname = NULL;
|
const char *grpname = NULL;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
alpm_db_t *db_local = alpm_get_localdb(config->handle);
|
|
||||||
|
|
||||||
if(targets == NULL) {
|
if(targets == NULL) {
|
||||||
for(j = alpm_db_get_groupcache(db_local); j; j = alpm_list_next(j)) {
|
for(j = alpm_db_get_groupcache(db_local); j; j = alpm_list_next(j)) {
|
||||||
|
@ -366,7 +367,10 @@ static int query_group(alpm_list_t *targets)
|
||||||
if(!filter(pkg)) {
|
if(!filter(pkg)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
printf("%s %s\n", grp->name, alpm_pkg_get_name(pkg));
|
printf("%s%s %s%s %s%s%s\n", colstr->groups, grp->name,
|
||||||
|
colstr->title, alpm_pkg_get_name(pkg),
|
||||||
|
colstr->version, alpm_pkg_get_version(pkg),
|
||||||
|
colstr->nocolor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -381,8 +385,10 @@ static int query_group(alpm_list_t *targets)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(!config->quiet) {
|
if(!config->quiet) {
|
||||||
printf("%s %s\n", grpname,
|
printf("%s%s %s%s %s%s%s\n", colstr->groups, grpname,
|
||||||
alpm_pkg_get_name(p->data));
|
colstr->title, alpm_pkg_get_name(p->data),
|
||||||
|
colstr->version, alpm_pkg_get_version(p->data),
|
||||||
|
colstr->nocolor);
|
||||||
} else {
|
} else {
|
||||||
printf("%s\n", alpm_pkg_get_name(p->data));
|
printf("%s\n", alpm_pkg_get_name(p->data));
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,6 +330,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *j, *k, *s = NULL;
|
alpm_list_t *i, *j, *k, *s = NULL;
|
||||||
alpm_db_t *db_local = alpm_get_localdb(config->handle);
|
alpm_db_t *db_local = alpm_get_localdb(config->handle);
|
||||||
|
const colstr_t *colstr = &config->colstr;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if(targets) {
|
if(targets) {
|
||||||
|
@ -346,8 +347,10 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
|
||||||
/* get names of packages in group */
|
/* get names of packages in group */
|
||||||
for(k = grp->packages; k; k = alpm_list_next(k)) {
|
for(k = grp->packages; k; k = alpm_list_next(k)) {
|
||||||
if(!config->quiet) {
|
if(!config->quiet) {
|
||||||
printf("%s %s", grpname,
|
printf("%s%s %s%s %s%s%s", colstr->groups, grpname,
|
||||||
alpm_pkg_get_name(k->data));
|
colstr->title, alpm_pkg_get_name(k->data),
|
||||||
|
colstr->version, alpm_pkg_get_version(k->data),
|
||||||
|
colstr->nocolor);
|
||||||
print_installed(db_local, k->data);
|
print_installed(db_local, k->data);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
} else {
|
} else {
|
||||||
|
@ -371,8 +374,10 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
|
||||||
|
|
||||||
if(level > 1) {
|
if(level > 1) {
|
||||||
for(k = grp->packages; k; k = alpm_list_next(k)) {
|
for(k = grp->packages; k; k = alpm_list_next(k)) {
|
||||||
printf("%s %s", grp->name,
|
printf("%s%s %s%s %s%s%s", colstr->groups, grp->name,
|
||||||
alpm_pkg_get_name(k->data));
|
colstr->title, alpm_pkg_get_name(k->data),
|
||||||
|
colstr->version, alpm_pkg_get_version(k->data),
|
||||||
|
colstr->nocolor);
|
||||||
print_installed(db_local, k->data);
|
print_installed(db_local, k->data);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue