summaryrefslogtreecommitdiffstats
path: root/src/pacman/sync.c
diff options
context:
space:
mode:
authorArtyom <smirnoffjr@gmail.com>2007-11-07 08:05:33 +0100
committerDan McGee <dan@archlinux.org>2007-11-25 21:33:32 +0100
commit1e9a1a0292dbbf8039b8fb7536dbff2af28c7afb (patch)
tree0e562b0608c2b530d12c3c07e4b9becb000d4ed2 /src/pacman/sync.c
parentc36b0f32c6f77cc363ed8f3ddc1a50625af944a9 (diff)
downloadpacman-1e9a1a0292dbbf8039b8fb7536dbff2af28c7afb.tar.gz
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/sync.c')
-rw-r--r--src/pacman/sync.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 889c682d..58e616e7 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -262,8 +262,12 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
alpm_list_t *grp;
pmpkg_t *pkg = alpm_list_getdata(j);
- printf("%s/%s %s", alpm_db_get_name(db), alpm_pkg_get_name(pkg),
- alpm_pkg_get_version(pkg));
+ if (!config->quiet) {
+ printf("%s/%s %s", alpm_db_get_name(db), 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) {
@@ -273,14 +277,16 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
printf(" [%.2f MB]", mbsize);
}
- if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
+ 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);
+ /* we need a newline and initial indent first */
+ printf("\n ");
+ indentprint(alpm_pkg_get_desc(pkg), 4);
+ }
printf("\n");
}
/* we only want to free if the list was a search list */
@@ -448,8 +454,12 @@ static int sync_list(alpm_list_t *syncs, alpm_list_t *targets)
for(j = alpm_db_getpkgcache(db); j; j = alpm_list_next(j)) {
pmpkg_t *pkg = alpm_list_getdata(j);
- printf("%s %s %s\n", alpm_db_get_name(db), alpm_pkg_get_name(pkg),
- alpm_pkg_get_version(pkg));
+ if (!config->quiet) {
+ printf("%s %s %s\n", alpm_db_get_name(db), alpm_pkg_get_name(pkg),
+ alpm_pkg_get_version(pkg));
+ } else {
+ printf("%s\n", alpm_pkg_get_name(pkg));
+ }
}
}