aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-01-21 17:00:58 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-01-21 17:00:48 +0000
commitd81f176639a80490c257bc075444948633ac64c7 (patch)
tree829f4c95a5d27a608feb0dd039d497ac447e544f
parenta492cbf5fd01559b0e6d5a823fccf58fa54e721a (diff)
downloadpaludis-d81f176639a80490c257bc075444948633ac64c7.tar.gz
paludis-d81f176639a80490c257bc075444948633ac64c7.tar.xz
Show whether choices are enabled
-rw-r--r--src/clients/cave/cmd_show.cc53
-rw-r--r--src/clients/cave/formats.cc26
-rw-r--r--src/clients/cave/formats.hh7
3 files changed, 81 insertions, 5 deletions
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index 04f08b4..ef7a6f1 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -458,7 +458,22 @@ namespace
for (Choice::ConstIterator v((*c)->begin()), v_end((*c)->end()) ;
v != v_end ; ++v)
- s << (*v)->unprefixed_name() << " ";
+ {
+ if ((*v)->enabled())
+ {
+ if ((*v)->locked())
+ s << format_general_s(f::show_choice_forced_enabled(), stringify((*v)->unprefixed_name())) << " ";
+ else
+ s << format_general_s(f::show_choice_enabled(), stringify((*v)->unprefixed_name())) << " ";
+ }
+ else
+ {
+ if ((*v)->locked())
+ s << format_general_s(f::show_choice_forced_disabled(), stringify((*v)->unprefixed_name())) << " ";
+ else
+ s << format_general_s(f::show_choice_disabled(), stringify((*v)->unprefixed_name())) << " ";
+ }
+ }
}
cout << format_general_rhvib(f::show_metadata_key_value(), k.raw_name(), k.human_name(),
s.str(), indent, important);
@@ -484,8 +499,40 @@ namespace
for (Choice::ConstIterator v((*c)->begin()), v_end((*c)->end()) ;
v != v_end ; ++v)
{
- cout << format_general_rhvib(f::show_metadata_key_value(), stringify((*v)->name_with_prefix()),
- stringify((*v)->unprefixed_name()), (*v)->description(), indent + 2, important);
+ if ((*v)->enabled())
+ {
+ if ((*v)->locked())
+ {
+ cout << format_general_rhvib(f::show_metadata_key_value(),
+ format_general_s(f::show_choice_forced_enabled(), stringify((*v)->name_with_prefix())),
+ format_general_s(f::show_choice_forced_enabled(), stringify((*v)->unprefixed_name())),
+ (*v)->description(), indent + 2, important);
+ }
+ else
+ {
+ cout << format_general_rhvib(f::show_metadata_key_value(),
+ format_general_s(f::show_choice_enabled(), stringify((*v)->name_with_prefix())),
+ format_general_s(f::show_choice_enabled(), stringify((*v)->unprefixed_name())),
+ (*v)->description(), indent + 2, important);
+ }
+ }
+ else
+ {
+ if ((*v)->locked())
+ {
+ cout << format_general_rhvib(f::show_metadata_key_value(),
+ format_general_s(f::show_choice_forced_disabled(), stringify((*v)->name_with_prefix())),
+ format_general_s(f::show_choice_forced_disabled(), stringify((*v)->unprefixed_name())),
+ (*v)->description(), indent + 2, important);
+ }
+ else
+ {
+ cout << format_general_rhvib(f::show_metadata_key_value(),
+ format_general_s(f::show_choice_disabled(), stringify((*v)->name_with_prefix())),
+ format_general_s(f::show_choice_disabled(), stringify((*v)->unprefixed_name())),
+ (*v)->description(), indent + 2, important);
+ }
+ }
}
}
}
diff --git a/src/clients/cave/formats.cc b/src/clients/cave/formats.cc
index 11f8f03..919f03a 100644
--- a/src/clients/cave/formats.cc
+++ b/src/clients/cave/formats.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -389,6 +389,30 @@ paludis::cave::f::show_contents_sym()
}
const std::string
+paludis::cave::f::show_choice_forced_enabled()
+{
+ return c::green() + "(%s)" + c::normal();
+}
+
+const std::string
+paludis::cave::f::show_choice_enabled()
+{
+ return c::green() + "%s" + c::normal();
+}
+
+const std::string
+paludis::cave::f::show_choice_forced_disabled()
+{
+ return c::red() + "(-%s)" + c::normal();
+}
+
+const std::string
+paludis::cave::f::show_choice_disabled()
+{
+ return c::red() + "-%s" + c::normal();
+}
+
+const std::string
paludis::cave::f::colour_formatter_indent()
{
return "%{column 30}%i%i%i%i";
diff --git a/src/clients/cave/formats.hh b/src/clients/cave/formats.hh
index 31cbbcb..ef96523 100644
--- a/src/clients/cave/formats.hh
+++ b/src/clients/cave/formats.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -76,6 +76,11 @@ namespace paludis
const std::string show_contents_fifo();
const std::string show_contents_sym();
+ const std::string show_choice_forced_enabled();
+ const std::string show_choice_enabled();
+ const std::string show_choice_forced_disabled();
+ const std::string show_choice_disabled();
+
const std::string colour_formatter_keyword_name_plain();
const std::string colour_formatter_keyword_name_accepted();
const std::string colour_formatter_keyword_name_unaccepted();