| 4224 | class CommandLine { |
| 4225 | |
| 4226 | struct Arg : CommonArgProperties<ConfigT>, OptionArgProperties, PositionalArgProperties { |
| 4227 | Arg() {} |
| 4228 | Arg( Detail::BoundArgFunction<ConfigT> const& _boundField ) : CommonArgProperties<ConfigT>( _boundField ) {} |
| 4229 | |
| 4230 | using CommonArgProperties<ConfigT>::placeholder; // !TBD |
| 4231 | |
| 4232 | std::string dbgName() const { |
| 4233 | if( !longName.empty() ) |
| 4234 | return "--" + longName; |
| 4235 | if( !shortNames.empty() ) |
| 4236 | return "-" + shortNames[0]; |
| 4237 | return "positional args"; |
| 4238 | } |
| 4239 | std::string commands() const { |
| 4240 | std::ostringstream oss; |
| 4241 | bool first = true; |
| 4242 | std::vector<std::string>::const_iterator it = shortNames.begin(), itEnd = shortNames.end(); |
| 4243 | for(; it != itEnd; ++it ) { |
| 4244 | if( first ) |
| 4245 | first = false; |
| 4246 | else |
| 4247 | oss << ", "; |
| 4248 | oss << "-" << *it; |
| 4249 | } |
| 4250 | if( !longName.empty() ) { |
| 4251 | if( !first ) |
| 4252 | oss << ", "; |
| 4253 | oss << "--" << longName; |
| 4254 | } |
| 4255 | if( !placeholder.empty() ) |
| 4256 | oss << " <" << placeholder << ">"; |
| 4257 | return oss.str(); |
| 4258 | } |
| 4259 | }; |
| 4260 | |
| 4261 | typedef CLARA_AUTO_PTR( Arg ) ArgAutoPtr; |
| 4262 | |