aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Alex Elsayed <eternaleye@gmail.com> 2011-06-28 17:10:23 -0700
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-06-30 10:27:28 +0100
commit2c58ebc323b45ec1e8fa0902741fad331c1bbb7e (patch)
tree78838a79091e0780980a7a0d9d18a92ce977d976
parente83a3ad0f53a5bd48e6f4cfdabac24914705b2ff (diff)
downloadpaludis-2c58ebc323b45ec1e8fa0902741fad331c1bbb7e.tar.gz
paludis-2c58ebc323b45ec1e8fa0902741fad331c1bbb7e.tar.xz
Start using the new format_package_id
-rw-r--r--src/clients/cave/Makefile.am1
-rw-r--r--src/clients/cave/cmd_print_dependent_ids.cc22
-rw-r--r--src/clients/cave/cmd_print_ids.cc22
-rw-r--r--src/clients/cave/cmd_print_owners.cc22
4 files changed, 7 insertions, 60 deletions
diff --git a/src/clients/cave/Makefile.am b/src/clients/cave/Makefile.am
index ec94522..2f042c8 100644
--- a/src/clients/cave/Makefile.am
+++ b/src/clients/cave/Makefile.am
@@ -212,6 +212,7 @@ libcave_a_SOURCES = \
colours.cc colours.hh \
exceptions.cc exceptions.hh \
executables_common.cc executables_common.hh \
+ format_package_id.cc format_package_id.hh \
format_plain_contents_entry.cc format_plain_contents_entry.hh \
format_plain_metadata_key.cc format_plain_metadata_key.hh \
format_string.cc format_string.hh \
diff --git a/src/clients/cave/cmd_print_dependent_ids.cc b/src/clients/cave/cmd_print_dependent_ids.cc
index 43131fc..8a82048 100644
--- a/src/clients/cave/cmd_print_dependent_ids.cc
+++ b/src/clients/cave/cmd_print_dependent_ids.cc
@@ -18,7 +18,7 @@
*/
#include "cmd_print_dependent_ids.hh"
-#include "format_string.hh"
+#include "format_package_id.hh"
#include "parse_spec_with_nice_error.hh"
#include "exceptions.hh"
#include <paludis/args/args.hh>
@@ -90,24 +90,6 @@ namespace
a_format.set_argument("%F\\n");
}
};
-
- std::string format_id(
- const PrintDependentIDsCommandLine & c,
- const std::shared_ptr<const PackageID> & i)
- {
- std::shared_ptr<Map<char, std::string> > m(std::make_shared<Map<char, std::string>>());
- m->insert('c', stringify(i->name().category()));
- m->insert('p', stringify(i->name().package()));
- m->insert('v', stringify(i->version()));
- m->insert('s', i->slot_key() ? stringify(i->slot_key()->parse_value()) : "");
- m->insert(':', i->slot_key() ? ":" : "");
- m->insert('r', stringify(i->repository_name()));
- m->insert('F', i->canonical_form(idcf_full));
- m->insert('V', i->canonical_form(idcf_version));
- m->insert('W', i->canonical_form(idcf_no_version));
- m->insert('N', i->canonical_form(idcf_no_name));
- return format_string(c.a_format.argument(), m);
- }
}
int
@@ -146,7 +128,7 @@ PrintDependentIDsCommand::run(
auto dependents(resolver::collect_dependents(env.get(), *ids->begin(), installed_ids));
for (auto i(dependents->begin()), i_end(dependents->end()) ;
i != i_end ; ++i)
- cout << format_id(cmdline, *i);
+ cout << format_package_id(*i, cmdline.a_format.argument());
return dependents->empty() ? EXIT_FAILURE : EXIT_SUCCESS;
}
diff --git a/src/clients/cave/cmd_print_ids.cc b/src/clients/cave/cmd_print_ids.cc
index 0c96c5d..b3326e2 100644
--- a/src/clients/cave/cmd_print_ids.cc
+++ b/src/clients/cave/cmd_print_ids.cc
@@ -18,7 +18,7 @@
*/
#include "cmd_print_ids.hh"
-#include "format_string.hh"
+#include "format_package_id.hh"
#include <paludis/args/args.hh>
#include <paludis/args/do_help.hh>
#include <paludis/name.hh>
@@ -238,24 +238,6 @@ namespace
{
}
};
-
- std::string format_id(
- const PrintIDsCommandLine & c,
- const std::shared_ptr<const PackageID> & i)
- {
- std::shared_ptr<Map<char, std::string> > m(std::make_shared<Map<char, std::string>>());
- m->insert('c', stringify(i->name().category()));
- m->insert('p', stringify(i->name().package()));
- m->insert('v', stringify(i->version()));
- m->insert('s', i->slot_key() ? stringify(i->slot_key()->parse_value()) : "");
- m->insert(':', i->slot_key() ? ":" : "");
- m->insert('r', stringify(i->repository_name()));
- m->insert('F', i->canonical_form(idcf_full));
- m->insert('V', i->canonical_form(idcf_version));
- m->insert('W', i->canonical_form(idcf_no_version));
- m->insert('N', i->canonical_form(idcf_no_name));
- return format_string(c.a_format.argument(), m);
- }
}
int
@@ -328,7 +310,7 @@ PrintIDsCommand::run(
const std::shared_ptr<const PackageIDSequence> ids((*env)[selection::AllVersionsSorted(fg)]);
for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
i != i_end ; ++i)
- cout << format_id(cmdline, *i);
+ cout << format_package_id(*i, cmdline.a_format.argument());
return EXIT_SUCCESS;
}
diff --git a/src/clients/cave/cmd_print_owners.cc b/src/clients/cave/cmd_print_owners.cc
index caa81b5..9851d1e 100644
--- a/src/clients/cave/cmd_print_owners.cc
+++ b/src/clients/cave/cmd_print_owners.cc
@@ -20,7 +20,7 @@
#include "cmd_print_owners.hh"
#include "command_command_line.hh"
-#include "format_string.hh"
+#include "format_package_id.hh"
#include "owner_common.hh"
#include <paludis/args/args.hh>
#include <paludis/args/do_help.hh>
@@ -92,29 +92,11 @@ namespace
}
};
- std::string format_id(
- const std::string & format,
- const std::shared_ptr<const PackageID> & i)
- {
- std::shared_ptr<Map<char, std::string> > m(std::make_shared<Map<char, std::string>>());
- m->insert('c', stringify(i->name().category()));
- m->insert('p', stringify(i->name().package()));
- m->insert('v', stringify(i->version()));
- m->insert('s', i->slot_key() ? stringify(i->slot_key()->parse_value()) : "");
- m->insert(':', i->slot_key() ? ":" : "");
- m->insert('r', stringify(i->repository_name()));
- m->insert('F', i->canonical_form(idcf_full));
- m->insert('V', i->canonical_form(idcf_version));
- m->insert('W', i->canonical_form(idcf_no_version));
- m->insert('N', i->canonical_form(idcf_no_name));
- return format_string(format, m);
- }
-
void print_package_id(
const std::string & format,
const std::shared_ptr<const PackageID> & id)
{
- cout << format_id(format, id);
+ cout << format_package_id(id, format);
}
}