MCPcopy Create free account
hub / github.com/cirquit/trdrop / addOptName

Method addOptName

ext/catch.hpp:4659–4675  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4657 typedef CLARA_AUTO_PTR( Arg ) ArgAutoPtr;
4658
4659 friend void addOptName( Arg& arg, std::string const& optName )
4660 {
4661 if( optName.empty() )
4662 return;
4663 if( Detail::startsWith( optName, "--" ) ) {
4664 if( !arg.longName.empty() )
4665 throw std::logic_error( "Only one long opt may be specified. '"
4666 + arg.longName
4667 + "' already specified, now attempting to add '"
4668 + optName + "'" );
4669 arg.longName = optName.substr( 2 );
4670 }
4671 else if( Detail::startsWith( optName, "-" ) )
4672 arg.shortNames.push_back( optName.substr( 1 ) );
4673 else
4674 throw std::logic_error( "option must begin with - or --. Option was: '" + optName + "'" );
4675 }
4676 friend void setPositionalArg( Arg& arg, int position )
4677 {
4678 arg.position = position;

Callers

nothing calls this directly

Calls 2

startsWithFunction · 0.85
emptyMethod · 0.80

Tested by

no test coverage detected