summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorJames Bowes <jbowes@redhat.com>2008-06-08 17:10:39 -0400
committerJames Bowes <jbowes@redhat.com>2008-06-08 17:11:41 -0400
commit9074e439d6102180298f5dcb4822fbcf2399a226 (patch)
treeb0da3090869a51eca9eb83e2d37d4a83983d0e32 /main.c
parent6b8b00f4b58bd1e42251e49bc51fd4ffec9787b7 (diff)
Import summary and description into the repo files.
Also add a 'info' command for displaying them.
Diffstat (limited to 'main.c')
-rw-r--r--main.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/main.c b/main.c
index 80ad114..f2f587d 100644
--- a/main.c
+++ b/main.c
@@ -810,6 +810,35 @@ command_download(int argc, const char *argv[])
return 0;
}
+static int
+command_info(int argc, const char *argv[])
+{
+ struct razor_set *set;
+ struct razor_package_iterator *pi;
+ struct razor_package *package;
+ const char *pattern = argv[0], *name, *version, *arch;
+
+ set = razor_set_open(repo_filename);
+ pi = razor_package_iterator_create(set);
+ while (razor_package_iterator_next(pi, &package,
+ &name, &version, &arch)) {
+ if (pattern && fnmatch(pattern, name, 0) != 0)
+ continue;
+
+ printf ("Name: %s\n", name);
+ printf ("Arch: %s\n", arch);
+ printf ("Version: %s\n", version);
+ printf ("Summary: %s\n", razor_package_get_summary (set, package));
+ printf ("Description:\n");
+ printf ("%s\n", razor_package_get_description (set, package));
+ printf ("\n");
+ }
+ razor_package_iterator_destroy(pi);
+ razor_set_destroy(set);
+
+ return 0;
+}
+
static struct {
const char *name;
const char *description;
@@ -834,7 +863,8 @@ static struct {
{ "diff", "show diff between two package sets", command_diff },
{ "install", "install rpm", command_install },
{ "init", "init razor root", command_init },
- { "download", "download packages", command_download }
+ { "download", "download packages", command_download },
+ { "info", "display package details", command_info }
};
static int