aboutsummaryrefslogtreecommitdiff
path: root/paludis/args/man.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-07-29 17:35:27 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-08-13 14:49:06 +0100
commitd6e4e464eeef466e4851056efe4e964a8b9ee266 (patch)
tree717c17310dd87cbe8a3f2ae9d3bf6129174c926d /paludis/args/man.cc
parent7f1155d0b5f33ce499760e15ec1edbf24a29448a (diff)
downloadpaludis-d6e4e464eeef466e4851056efe4e964a8b9ee266.tar.gz
paludis-d6e4e464eeef466e4851056efe4e964a8b9ee266.tar.xz
Let enum args have single letter alias
Diffstat (limited to 'paludis/args/man.cc')
-rw-r--r--paludis/args/man.cc30
1 files changed, 16 insertions, 14 deletions
diff --git a/paludis/args/man.cc b/paludis/args/man.cc
index 433c21e37..17ba90a0d 100644
--- a/paludis/args/man.cc
+++ b/paludis/args/man.cc
@@ -65,9 +65,7 @@ namespace
for (EnumArg::AllowedArgConstIterator a(e.begin_allowed_args()), a_end(e.end_allowed_args()) ;
a != a_end ; ++a)
- {
- _dw.extra_arg_enum(a->first, a->second, e.default_arg());
- }
+ _dw.extra_arg_enum(*a, e.default_arg());
_dw.end_extra_arg();
}
@@ -79,11 +77,9 @@ namespace
_dw.start_extra_arg();
- for (EnumArg::AllowedArgConstIterator a(e.begin_allowed_args()), a_end(e.end_allowed_args()) ;
+ for (StringSetArg::AllowedArgConstIterator a(e.begin_allowed_args()), a_end(e.end_allowed_args()) ;
a != a_end ; ++a)
- {
_dw.extra_arg_string_set(a->first, a->second);
- }
_dw.end_extra_arg();
}
@@ -241,14 +237,17 @@ HtmlWriter::start_extra_arg()
}
void
-HtmlWriter::extra_arg_enum(const std::string & first, const std::string & second, const std::string & default_arg)
+HtmlWriter::extra_arg_enum(const AllowedEnumArg & e, const std::string & default_arg)
{
std::string default_string;
- if (first == default_arg)
+ if (e.long_name() == default_arg)
default_string = " (default)";
- _os << "<dt>" << first << "</dt>" << endl;
- _os << "<dd>" << second << default_string << "</dd>" << endl;
+ _os << "<dt>" << e.long_name();
+ if (e.short_name())
+ _os << " (" << std::string(1, e.short_name()) << ")";
+ _os << "</dt>" << endl;
+ _os << "<dd>" << e.description() << default_string << "</dd>" << endl;
}
void
@@ -441,16 +440,19 @@ ManWriter::start_extra_arg()
}
void
-ManWriter::extra_arg_enum(const std::string & first, const std::string & second, const std::string & default_arg)
+ManWriter::extra_arg_enum(const AllowedEnumArg & e, const std::string & default_arg)
{
std::string default_string;
- if (first == default_arg)
+ if (e.long_name() == default_arg)
default_string = " (default)";
_os << ".RS" << endl;
_os << ".TP" << endl;
- _os << ".B \"" << first << "\"" << endl;
- _os << second << default_string << endl;
+ _os << ".B \"" << e.long_name();
+ if (e.short_name())
+ _os << " (" << std::string(1, e.short_name()) << ")";
+ _os << "\"" << endl;
+ _os << e.description() << default_string << endl;
_os << ".RE" << endl;
}