index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
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 | |
parent | c36b0f32c6f77cc363ed8f3ddc1a50625af944a9 (diff) |
-rw-r--r-- | src/pacman/conf.h | 1 | ||||
-rw-r--r-- | src/pacman/pacman.c | 8 | ||||
-rw-r--r-- | src/pacman/query.c | 29 | ||||
-rw-r--r-- | src/pacman/sync.c | 28 |
diff --git a/src/pacman/conf.h b/src/pacman/conf.h index ee55e1d9..01d69498 100644 --- a/src/pacman/conf.h +++ b/src/pacman/conf.h @@ -26,6 +26,7 @@ typedef struct __config_t { char *configfile; unsigned short op; + unsigned short quiet; unsigned short verbose; unsigned short version; unsigned short help; diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 10f4c24b..4c24d10b 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -112,6 +112,7 @@ static void usage(int op, const char * const myname) printf(_(" -s, --search <regex> search locally-installed packages for matching strings\n")); printf(_(" -t, --orphans list all packages not required by any package\n")); printf(_(" -u, --upgrades list all packages that can be upgraded\n")); + printf(_(" -q --quiet show less information for query and search\n")); } else if(op == PM_OP_SYNC) { printf("%s: %s {-S --sync} [%s] [%s]\n", str_usg, myname, str_opt, str_pkg); printf("%s:\n", str_opt); @@ -131,6 +132,7 @@ static void usage(int op, const char * const myname) printf(_(" --ignore <pkg> ignore a package upgrade (can be used more than once)\n")); printf(_(" --ignoregroup <grp>\n" " ignore a group upgrade (can be used more than once)\n")); + printf(_(" -q --quiet show less information for query and search\n")); } printf(_(" --config <path> set an alternate configuration file\n")); printf(_(" --logfile <path> set an alternate log file\n")); @@ -286,6 +288,7 @@ static int parseargs(int argc, char *argv[]) {"owns", no_argument, 0, 'o'}, {"file", no_argument, 0, 'p'}, {"print-uris", no_argument, 0, 'p'}, + {"quiet", no_argument, 0, 'q'}, {"root", required_argument, 0, 'r'}, {"recursive", no_argument, 0, 's'}, {"search", no_argument, 0, 's'}, @@ -308,7 +311,7 @@ static int parseargs(int argc, char *argv[]) {0, 0, 0, 0} }; - while((opt = getopt_long(argc, argv, "ARUFQSTr:b:vkhscVfmnoldepituwygz", opts, &option_index))) { + while((opt = getopt_long(argc, argv, "ARUFQSTr:b:vkhscVfmnoldepituwygzq", opts, &option_index))) { alpm_list_t *list = NULL, *item = NULL; /* lists for splitting strings */ if(opt < 0) { @@ -448,6 +451,9 @@ static int parseargs(int argc, char *argv[]) config->flags |= PM_TRANS_FLAG_NOCONFLICTS; break; case 'y': (config->op_s_sync)++; break; + case 'q': + config->quiet = 1; + break; case '?': return(1); default: return(1); } 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)); + } } } 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)); + } } } |