diff options
author | Artyom <smirnoffjr@gmail.com> | 2007-11-07 01:05:33 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-11-25 14:33:32 -0600 |
commit | 1e9a1a0292dbbf8039b8fb7536dbff2af28c7afb (patch) | |
tree | 0e562b0608c2b530d12c3c07e4b9becb000d4ed2 /src/pacman/query.c | |
parent | c36b0f32c6f77cc363ed8f3ddc1a50625af944a9 (diff) | |
download | pacman-1e9a1a0292dbbf8039b8fb7536dbff2af28c7afb.tar.xz |
Add -q/--quiet option for controlling output.
Currently this only affects -Ss, -Sl, and -Q to output less information (only
package names).
In the future, we can reuse this flag for other things as well.
[Aaron: rewritten as a front-end flag]
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
[Dan: squashed commits together]
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src/pacman/query.c')
-rw-r--r-- | src/pacman/query.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/pacman/query.c b/src/pacman/query.c index 8af05e06..e780d6e0 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -146,7 +146,11 @@ static int query_search(alpm_list_t *targets) alpm_list_t *grp; pmpkg_t *pkg = alpm_list_getdata(i); - printf("local/%s %s", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg)); + if (!config->quiet) { + printf("local/%s %s", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg)); + } else { + printf("%s", alpm_pkg_get_name(pkg)); + } /* print the package size with the output if ShowSize option set */ if(config->showsize) { @@ -156,14 +160,17 @@ static int query_search(alpm_list_t *targets) printf(" [%.2f MB]", mbsize); } - if((grp = alpm_pkg_get_groups(pkg)) != NULL) { - group = alpm_list_getdata(grp); - printf(" (%s)", (char *)alpm_list_getdata(grp)); - } - /* we need a newline and initial indent first */ - printf("\n "); - indentprint(alpm_pkg_get_desc(pkg), 4); + if (!config->quiet) { + if((grp = alpm_pkg_get_groups(pkg)) != NULL) { + group = alpm_list_getdata(grp); + printf(" (%s)", (char *)alpm_list_getdata(grp)); + } + + /* we need a newline and initial indent first */ + printf("\n "); + indentprint(alpm_pkg_get_desc(pkg), 4); + } printf("\n"); } @@ -307,7 +314,11 @@ static void display(pmpkg_t *pkg) dump_pkg_changelog(changelog, alpm_pkg_get_name(pkg)); } if(!config->op_q_info && !config->op_q_list && !config->op_q_changelog) { - printf("%s %s\n", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg)); + if (!config->quiet) { + printf("%s %s\n", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg)); + } else { + printf("%s\n", alpm_pkg_get_name(pkg)); + } } } |