MCPcopy Create free account
hub / github.com/FidoProject/Fido / addOptName

Method addOptName

tests/catch.h:4263–4279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4261 typedef CLARA_AUTO_PTR( Arg ) ArgAutoPtr;
4262
4263 friend void addOptName( Arg& arg, std::string const& optName )
4264 {
4265 if( optName.empty() )
4266 return;
4267 if( Detail::startsWith( optName, "--" ) ) {
4268 if( !arg.longName.empty() )
4269 throw std::logic_error( "Only one long opt may be specified. '"
4270 + arg.longName
4271 + "' already specified, now attempting to add '"
4272 + optName + "'" );
4273 arg.longName = optName.substr( 2 );
4274 }
4275 else if( Detail::startsWith( optName, "-" ) )
4276 arg.shortNames.push_back( optName.substr( 1 ) );
4277 else
4278 throw std::logic_error( "option must begin with - or --. Option was: '" + optName + "'" );
4279 }
4280 friend void setPositionalArg( Arg& arg, int position )
4281 {
4282 arg.position = position;

Callers

nothing calls this directly

Calls 2

startsWithFunction · 0.85
emptyMethod · 0.80

Tested by

no test coverage detected