aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Łukasz P. Michalik <lpmichalik@googlemail.com> 2016-12-13 16:12:10 +0100
committerAvatar Bo Ørsted Andresen <zlin@exherbo.org> 2016-12-28 16:46:50 +0100
commit2c88125e96b2452c4833042b9016ff39b72dcfd3 (patch)
treea87eca23187db2d5335600b133d3e6094c3bc76d
parent07f5a179f295bff388f4be778d2e0890080fcc9e (diff)
downloadpaludis-2c88125e96b2452c4833042b9016ff39b72dcfd3.tar.gz
paludis-2c88125e96b2452c4833042b9016ff39b72dcfd3.tar.xz
format package: %I as shorthand for %c/%p%:%s
Change-Id: I26c70aca17e07a8a71cc6fa4431c40580df07003 Reviewed-on: https://galileo.mailstation.de/gerrit/7777 Reviewed-by: Bo Ørsted Andresen <zlin@exherbo.org>
-rw-r--r--src/clients/cave/cmd_print_dependent_ids.cc8
-rw-r--r--src/clients/cave/cmd_print_ids.cc8
-rw-r--r--src/clients/cave/cmd_print_owners.cc8
-rw-r--r--src/clients/cave/format_package_id.cc13
-rw-r--r--src/clients/cave/format_package_id.hh2
5 files changed, 17 insertions, 22 deletions
diff --git a/src/clients/cave/cmd_print_dependent_ids.cc b/src/clients/cave/cmd_print_dependent_ids.cc
index ba5817d..ebc1142 100644
--- a/src/clients/cave/cmd_print_dependent_ids.cc
+++ b/src/clients/cave/cmd_print_dependent_ids.cc
@@ -79,13 +79,7 @@ namespace
PrintDependentIDsCommandLine() :
g_display_options(main_options_section(), "Display Options", "Controls the output format."),
- a_format(&g_display_options, "format", 'f', "Select the output format. Special tokens recognised are "
- "%c for category, %p for package, %v for version, %s for slot, %S for slot in its native format, "
- "%: for ':' if we have a slot and "
- "empty otherwise, %r for repository, %F for the canonical full form, %V for the canonical full "
- "version, %W for the canonical full unversioned form, %N for the canonical full unnamed form, "
- "%u for a uniquely identifying dependency spec, "
- "\\n for newline, \\t for tab. Default is '%F\\n'.")
+ a_format(&g_display_options, "format", 'f', format_package_id_help)
{
add_usage_line("spec");
a_format.set_argument("%F\\n");
diff --git a/src/clients/cave/cmd_print_ids.cc b/src/clients/cave/cmd_print_ids.cc
index bf8e128..3c29f5f 100644
--- a/src/clients/cave/cmd_print_ids.cc
+++ b/src/clients/cave/cmd_print_ids.cc
@@ -106,13 +106,7 @@ namespace
("unsupported", "masked because it is unsupported")
),
g_display_options(main_options_section(), "Display Options", "Controls the output format."),
- a_format(&g_display_options, "format", 'f', "Select the output format. Special tokens recognised are "
- "%c for category, %p for package, %v for version, %s for slot, %S for slot in its native format, "
- "%: for ':' if we have a slot and "
- "empty otherwise, %r for repository, %F for the canonical full form, %V for the canonical full "
- "version, %W for the canonical full unversioned form, %N for the canonical full unnamed form, "
- "%u for a uniquely identifying dependency spec, "
- "\\n for newline, \\t for tab. Default is '%F\\n'.")
+ a_format(&g_display_options, "format", 'f', format_package_id_help)
{
add_usage_line("[ --matching spec ] [ --supporting action ] [ --with-mask mask-kind ]");
a_format.set_argument("%F\\n");
diff --git a/src/clients/cave/cmd_print_owners.cc b/src/clients/cave/cmd_print_owners.cc
index a90047c..a863825 100644
--- a/src/clients/cave/cmd_print_owners.cc
+++ b/src/clients/cave/cmd_print_owners.cc
@@ -80,13 +80,7 @@ namespace
"times, only IDs matching every spec are selected.",
args::StringSetArg::StringSetArgOptions()),
g_display_options(main_options_section(), "Display Options", "Controls the output format."),
- a_format(&g_display_options, "format", 'f', "Select the output format. Special tokens recognised are "
- "%c for category, %p for package, %v for version, %s for slot, %S for slot in its native format, "
- "%: for ':' if we have a slot and "
- "empty otherwise, %r for repository, %F for the canonical full form, %V for the canonical full "
- "version, %W for the canonical full unversioned form, %N for the canonical full unnamed form, "
- "%u for a uniquely identifying dependency spec, "
- "\\n for newline, \\t for tab. Default is '%F\\n'.")
+ a_format(&g_display_options, "format", 'f', format_package_id_help)
{
add_usage_line("[ --type algorithm ] [ --matching spec ] pattern");
a_format.set_argument("%F\\n");
diff --git a/src/clients/cave/format_package_id.cc b/src/clients/cave/format_package_id.cc
index 3e12359..d75e741 100644
--- a/src/clients/cave/format_package_id.cc
+++ b/src/clients/cave/format_package_id.cc
@@ -48,6 +48,9 @@ paludis::cave::format_package_id(
m->insert('s', id->slot_key() ? stringify(id->slot_key()->parse_value().parallel_value()) : "");
m->insert('S', id->slot_key() ? stringify(id->slot_key()->parse_value().raw_value()) : "");
m->insert(':', id->slot_key() ? ":" : "");
+ m->insert('I', stringify(id->name().category()) + '/' + stringify(id->name().package()) +
+ (id->slot_key() ?
+ ":" + stringify(id->slot_key()->parse_value().parallel_value()) : ""));
m->insert('r', stringify(id->repository_name()));
m->insert('F', id->canonical_form(idcf_full));
m->insert('V', id->canonical_form(idcf_version));
@@ -57,4 +60,12 @@ paludis::cave::format_package_id(
return format_string(format, m);
}
-
+const std::string paludis::cave::format_package_id_help(
+ "Select the output format. Special tokens recognised are "
+ "%c for category, %p for package, %v for version, %s for slot, %S for slot in its native format, "
+ "%: for ':' if we have a slot and "
+ "empty otherwise, %r for repository, %F for the canonical full form, %V for the canonical full "
+ "version, %W for the canonical full unversioned form, %N for the canonical full unnamed form, "
+ "%u for a uniquely identifying dependency spec, %I is equivalent to %c/%p%:%s,"
+ "\\n for newline, \\t for tab. Default is '%F\\n'."
+);
diff --git a/src/clients/cave/format_package_id.hh b/src/clients/cave/format_package_id.hh
index 7cb81c2..b03c721 100644
--- a/src/clients/cave/format_package_id.hh
+++ b/src/clients/cave/format_package_id.hh
@@ -35,6 +35,8 @@ namespace paludis
const std::shared_ptr<const PackageID> & id,
const std::string & format)
PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ extern const std::string format_package_id_help;
}
}