aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-19 16:43:20 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-19 16:43:20 +0000
commitd03c56fa8e1053678d59f57ba95e8639c8d05c8b (patch)
treede83527a9470f307277393d050f10e7f712524e7
parentaaba816e781109186d9d33820848af5936347924 (diff)
downloadpaludis-d03c56fa8e1053678d59f57ba95e8639c8d05c8b.tar.gz
paludis-d03c56fa8e1053678d59f57ba95e8639c8d05c8b.tar.xz
Add --list-dep-tag-categories and related test
-rw-r--r--src/Makefile.am6
-rw-r--r--src/applets.cc22
-rw-r--r--src/applets.hh3
-rw-r--r--src/command_line.cc1
-rw-r--r--src/command_line.hh3
-rw-r--r--src/paludis.cc9
6 files changed, 41 insertions, 3 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 56aa16b..9f2fdad 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,7 +28,8 @@ TESTS_ENVIRONMENT = env \
PALUDIS_SKIP_CONFIG="yes" \
$(SHELL) $(top_srcdir)/test/run_test.sh bash
-TESTS = version_TEST help_TEST list_sync_formats_TEST list_repository_formats_TEST
+TESTS = version_TEST help_TEST list_sync_formats_TEST \
+ list_repository_formats_TEST list_dep_tag_categories_TEST
CLEANFILES = *~ $(TESTS) gmon.out *.gcov *.gcno *.gcda
MAINTAINERCLEANFILES = Makefile.in
@@ -45,3 +46,6 @@ list_sync_formats_TEST : paludis
list_repository_formats_TEST : paludis
echo -e "#!/bin/sh\n./paludis --list-repository-formats" > $@
+list_dep_tag_categories_TEST : paludis
+ echo -e "#!/bin/sh\n./paludis --list-dep-tag-categories" > $@
+
diff --git a/src/applets.cc b/src/applets.cc
index 1a7885a..5654403 100644
--- a/src/applets.cc
+++ b/src/applets.cc
@@ -27,8 +27,8 @@
#include <set>
/** \file
- * Handle the --has-version and --best-version actions for the main paludis
- * program.
+ * Handle the --has-version, --best-version and various --list actions for the
+ * main paludis program.
*/
namespace p = paludis;
@@ -105,3 +105,21 @@ int do_list_sync_protocols()
return return_code;
}
+int do_list_dep_tag_categories()
+{
+ int return_code(1);
+
+ std::set<std::string> keys;
+ p::DepTagCategoryMaker::get_instance()->copy_keys(std::inserter(keys, keys.begin()));
+
+ if (! keys.empty())
+ {
+ return_code = 0;
+ for (std::set<std::string>::const_iterator k(keys.begin()), k_end(keys.end()) ;
+ k != k_end ; ++k)
+ std::cout << "* " << colour(cl_package_name, *k) << std::endl;
+ }
+
+ return return_code;
+}
+
diff --git a/src/applets.hh b/src/applets.hh
index bdb446d..7474c0f 100644
--- a/src/applets.hh
+++ b/src/applets.hh
@@ -38,5 +38,8 @@ int do_list_repository_formats();
/// Handle --list-sync-protocols
int do_list_sync_protocols();
+/// Handle --list-dep-tag-categories
+int do_list_dep_tag_categories();
+
#endif
diff --git a/src/command_line.cc b/src/command_line.cc
index 528f410..cbefdfc 100644
--- a/src/command_line.cc
+++ b/src/command_line.cc
@@ -32,6 +32,7 @@ CommandLine::CommandLine() :
a_list_packages(&action_args, "list-packages", '\0', "List available packages"),
a_list_sync_protocols(&action_args, "list-sync-protocols", '\0', "List available sync protocols"),
a_list_repository_formats(&action_args, "list-repository-formats", '\0', "List available repository formats"),
+ a_list_dep_tag_categories(&action_args, "list-dep-tag-categories", '\0', "List known dep tag categories"),
a_has_version(&action_args, "has-version", '\0', "Check whether the specified atom is installed"),
a_best_version(&action_args, "best-version", '\0', "Display the best version of the specified atom"),
a_version(&action_args, "version", 'V', "Display program version"),
diff --git a/src/command_line.hh b/src/command_line.hh
index 6291a56..fb92eeb 100644
--- a/src/command_line.hh
+++ b/src/command_line.hh
@@ -77,6 +77,9 @@ class CommandLine :
/// --list-repository-formats
paludis::args::SwitchArg a_list_repository_formats;
+ /// --list-dep-tag-categories
+ paludis::args::SwitchArg a_list_dep_tag_categories;
+
/// --has-version
paludis::args::SwitchArg a_has_version;
diff --git a/src/paludis.cc b/src/paludis.cc
index bb6e49a..e055143 100644
--- a/src/paludis.cc
+++ b/src/paludis.cc
@@ -85,6 +85,7 @@ main(int argc, char *argv[])
CommandLine::get_instance()->a_list_packages.specified() +
CommandLine::get_instance()->a_list_sync_protocols.specified() +
CommandLine::get_instance()->a_list_repository_formats.specified() +
+ CommandLine::get_instance()->a_list_dep_tag_categories.specified() +
CommandLine::get_instance()->a_has_version.specified() +
CommandLine::get_instance()->a_best_version.specified()))
{
@@ -128,6 +129,14 @@ main(int argc, char *argv[])
return do_list_repository_formats();
}
+ if (CommandLine::get_instance()->a_list_dep_tag_categories.specified())
+ {
+ if (! CommandLine::get_instance()->empty())
+ throw DoHelp("list-dep-tag-categories action takes no parameters");
+
+ return do_list_dep_tag_categories();
+ }
+
/* these actions do need DefaultConfig */
std::string paludis_command(argv[0]);