5 #include "cvmfs_config.h"
20 int CmdHelp::Main(
const Options &options) {
30 for (
unsigned i = 0; i < cmd->
GetName().length() + 11; ++i)
41 if (!examples.empty()) {
44 std::vector<std::string> ex_lines =
SplitString(examples,
'\n');
45 for (
unsigned i = 0; i < ex_lines.size() - 1; ++i) {
52 if (params.empty())
return 0;
56 string::size_type max_len = 0;
57 for (
unsigned i = 0; i < params.size(); ++i) {
58 string::size_type l = params[i].key.length();
59 if (!params[i].is_switch) {
60 l += 3 + params[i].arg_name.length();
62 max_len = std::max(max_len, l);
64 for (
unsigned i = 0; i < params.size(); ++i) {
66 params[i].short_key, params[i].key.c_str(),
68 "" : (
" <" + params[i].arg_name +
">").c_str());
69 unsigned l = params[i].key.length();
70 if (!params[i].is_switch) l += 3 + params[i].arg_name.length();
71 for (
unsigned p = l; p < max_len; ++p)
74 params[i].description.c_str(),
75 params[i].is_optional ?
"" :
" [mandatory]");
std::string GetExamples() const
const std::vector< Argument > & plain_args() const
vector< string > SplitString(const string &str, char delim)
virtual std::string GetDescription() const
std::vector< Parameter > ParameterList
virtual std::string GetUsage() const
virtual ParameterList GetParams() const =0
virtual std::string GetName() const =0
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)