23 #ifndef TCLAP_ZSHCOMPLETIONOUTPUT_H 24 #define TCLAP_ZSHCOMPLETIONOUTPUT_H 82 std::map<std::string, std::string>
common;
91 common[
"hostname"] =
"_hosts";
93 common[
"filename"] =
"_files";
95 common[
"username"] =
"_users";
96 common[
"directory"] =
"_directories";
97 common[
"path"] =
"_directories";
114 std::cout <<
"#compdef " << progName << std::endl << std::endl <<
115 "# " << progName <<
" version " << _cmd.
getVersion() << std::endl << std::endl <<
120 if ( (*it)->shortID().at(0) ==
'<' )
122 else if ( (*it)->getFlag() !=
"-" )
132 static_cast<void>(_cmd);
138 size_t idx = s.find_last_of(
':');
139 while ( idx != std::string::npos )
141 s.insert(idx, 1,
'\\');
142 idx = s.find_last_of(
':', idx);
144 idx = s.find_last_of(
'\'');
145 while ( idx != std::string::npos )
147 s.insert(idx,
"'\\'");
149 idx = std::string::npos;
151 idx = s.find_last_of(
'\'', --idx);
157 size_t p = s.find_last_of(
'/');
158 if ( p != std::string::npos )
166 static int count = 1;
178 std::map<std::string, std::string>::iterator compArg =
common.find(a->
getName());
179 if ( compArg !=
common.end() )
198 if (!desc.compare(0, 12,
"(required) "))
202 if (!desc.compare(0, 15,
"(OR required) "))
206 size_t len = desc.length();
207 if (len && desc.at(--len) ==
'.')
213 desc.replace(0, 1, 1, tolower(desc.at(0)));
216 std::cout <<
" \\" << std::endl <<
" '" << mutex;
224 std::cout <<
"'{" << flag <<
',' << name <<
"}'";
235 if ( arg.at(arg.length()-1) ==
']' )
236 arg.erase(arg.length()-1);
237 if ( arg.at(arg.length()-1) ==
']' )
239 arg.erase(arg.length()-1);
241 if ( arg.at(0) ==
'<' )
243 arg.erase(arg.length()-1);
246 size_t p = arg.find(
'|');
247 if ( p != std::string::npos )
251 arg.replace(p, 1, 1,
' ');
253 while ( (p = arg.find_first_of(
'|', p)) != std::string::npos );
260 std::map<std::string, std::string>::iterator compArg =
common.find(arg);
261 if ( compArg !=
common.end() )
274 std::vector< std::vector<Arg*> > xorList = xorHandler.
getXorList();
281 std::ostringstream list;
287 for (
int i = 0;
static_cast<unsigned int>(
i) < xorList.size();
i++ )
290 it != xorList[
i].end();
296 iu != xorList[
i].end();
299 bool notCur = (*iu) !=
a;
300 bool hasFlag = !(*iu)->getFlag().empty();
301 if ( iu != xorList[
i].
begin() && (notCur || hasFlag) )
304 list << (*iu)->flagStartChar() << (*iu)->getFlag() <<
' ';
305 if ( notCur || hasFlag )
306 list << (*iu)->nameStartString() << (*iu)->getName();
std::vector< std::vector< Arg * > > & getXorList()
const char * what() const
GLuint const GLchar * name
std::string getDescription() const
virtual std::string & getProgramName()=0
static char flagStartChar()
GLsizei const GLchar *const * string
virtual std::list< Arg * > & getArgList()=0
virtual char getDelimiter()=0
void quoteSpecialChars(std::string &s)
const std::string & getName() const
bool isValueRequired() const
GLboolean GLboolean GLboolean GLboolean a
virtual std::string & getVersion()=0
virtual void version(CmdLineInterface &c)
void printOption(Arg *it, std::string mutex)
void basename(std::string &s)
const std::string & getFlag() const
virtual XorHandler & getXorHandler()=0
static const std::string nameStartString()
static bool hasFlag(Enum e, base::type::EnumType flag)
virtual void usage(CmdLineInterface &c)
virtual std::string shortID(const std::string &valueId="val") const
std::list< Arg * >::iterator ArgListIterator
virtual bool acceptsMultipleValues()
std::vector< Arg * >::iterator ArgVectorIterator
std::map< std::string, std::string > common
GeneratorWrapper< T > map(Func &&function, GeneratorWrapper< U > &&generator)
std::string getMutexList(CmdLineInterface &_cmd, Arg *a)
virtual void failure(CmdLineInterface &c, ArgException &e)
virtual bool isRequired() const