aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-16 19:12:38 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-16 21:15:08 +0100
commit2a49ae23c623e5aad14d9d46d7a109fd38e3e181 (patch)
tree478a3b423fe9b45c6e6bc051fb4b4fcb7b40a971
parentae91478716a5e6d2433c2fef04584e79921dfa64 (diff)
downloadpaludis-2a49ae23c623e5aad14d9d46d7a109fd38e3e181.tar.gz
paludis-2a49ae23c623e5aad14d9d46d7a109fd38e3e181.tar.xz
fmt contents
-rw-r--r--src/clients/cave/Makefile.am2
-rw-r--r--src/clients/cave/cmd_contents-fmt.hh14
-rw-r--r--src/clients/cave/cmd_contents.cc17
-rw-r--r--src/clients/cave/formats.cc24
-rw-r--r--src/clients/cave/formats.hh5
5 files changed, 25 insertions, 37 deletions
diff --git a/src/clients/cave/Makefile.am b/src/clients/cave/Makefile.am
index 2117faa..70ff463 100644
--- a/src/clients/cave/Makefile.am
+++ b/src/clients/cave/Makefile.am
@@ -110,7 +110,7 @@ libcave_a_SOURCES = \
command_line.cc command_line.hh \
command_command_line.cc command_command_line.hh \
command_factory.cc command_factory.hh \
- cmd_contents.cc cmd_contents.hh \
+ cmd_contents.cc cmd_contents.hh cmd_contents-fmt.hh \
cmd_config.cc cmd_config.hh \
cmd_display_resolution.cc cmd_display_resolution.hh \
cmd_executables.cc cmd_executables.hh \
diff --git a/src/clients/cave/cmd_contents-fmt.hh b/src/clients/cave/cmd_contents-fmt.hh
new file mode 100644
index 0000000..ccae47b
--- /dev/null
+++ b/src/clients/cave/cmd_contents-fmt.hh
@@ -0,0 +1,14 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+const auto fs_file = make_format_string_fetcher("contents/file", 1)
+ << c::bold_blue_or_pink() << param<'s'>() << c::normal();
+
+const auto fs_dir = make_format_string_fetcher("contents/dir", 1)
+ << c::blue_or_pink() << param<'s'>() << c::normal();
+
+const auto fs_sym = make_format_string_fetcher("contents/sym", 1)
+ << c::bold_green_or_pink() << param<'s'>() << c::normal() << " -> " << param<'t'>();
+
+const auto fs_other = make_format_string_fetcher("contents/other", 1)
+ << c::bold_yellow() << param<'s'>() << c::normal();
+
diff --git a/src/clients/cave/cmd_contents.cc b/src/clients/cave/cmd_contents.cc
index 9ff5f32..00f2c4e 100644
--- a/src/clients/cave/cmd_contents.cc
+++ b/src/clients/cave/cmd_contents.cc
@@ -18,9 +18,9 @@
*/
#include "cmd_contents.hh"
-#include "exceptions.hh"
+#include "format_user_config.hh"
#include "formats.hh"
-#include "format_general.hh"
+#include "exceptions.hh"
#include <paludis/args/args.hh>
#include <paludis/args/do_help.hh>
#include <paludis/environment.hh>
@@ -51,6 +51,8 @@ using std::endl;
namespace
{
+#include "cmd_contents-fmt.hh"
+
struct ContentsCommandLine :
CaveCommandCommandLine
{
@@ -79,23 +81,24 @@ namespace
{
std::string visit(const ContentsFileEntry & e) const
{
- return format_general_s(f::contents_file(), stringify(e.location_key()->value()));
+ return fuc(fs_file(), fv<'s'>(stringify(e.location_key()->value())));
}
std::string visit(const ContentsDirEntry & e) const
{
- return format_general_s(f::contents_dir(), stringify(e.location_key()->value()));
+ return fuc(fs_dir(), fv<'s'>(stringify(e.location_key()->value())));
}
std::string visit(const ContentsSymEntry & e) const
{
- return format_general_sr(f::contents_sym(), stringify(e.location_key()->value()),
- stringify(e.target_key()->value()));
+ return fuc(fs_sym(),
+ fv<'s'>(stringify(e.location_key()->value())),
+ fv<'t'>(stringify(e.target_key()->value())));
}
std::string visit(const ContentsOtherEntry & e) const
{
- return format_general_s(f::contents_other(), stringify(e.location_key()->value()));
+ return fuc(fs_other(), fv<'s'>(stringify(e.location_key()->value())));
}
};
diff --git a/src/clients/cave/formats.cc b/src/clients/cave/formats.cc
index 6c653b8..dedb744 100644
--- a/src/clients/cave/formats.cc
+++ b/src/clients/cave/formats.cc
@@ -641,30 +641,6 @@ paludis::cave::f::sync_repo_tail()
}
const std::string
-paludis::cave::f::contents_file()
-{
- return c::bold_blue_or_pink() + "%s" + c::normal();
-}
-
-const std::string
-paludis::cave::f::contents_dir()
-{
- return c::blue_or_pink() + "%s" + c::normal();
-}
-
-const std::string
-paludis::cave::f::contents_sym()
-{
- return c::bold_green_or_pink() + "%s" + c::normal() + " -> %r";
-}
-
-const std::string
-paludis::cave::f::contents_other()
-{
- return c::bold_yellow() + "%s" + c::normal();
-}
-
-const std::string
paludis::cave::f::owner_id()
{
return c::bold_blue_or_pink() + "%s" + c::normal() + "\\n";
diff --git a/src/clients/cave/formats.hh b/src/clients/cave/formats.hh
index 5cc2cee..e35685b 100644
--- a/src/clients/cave/formats.hh
+++ b/src/clients/cave/formats.hh
@@ -161,11 +161,6 @@ namespace paludis
const std::string sync_repo_active_quiet();
const std::string sync_repo_tail();
- const std::string contents_file();
- const std::string contents_dir();
- const std::string contents_sym();
- const std::string contents_other();
-
const std::string owner_id();
const std::string executables_file();