mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-09-15 07:04:59 -04:00
UnlabeledValueArg change
This commit is contained in:
parent
db95c71374
commit
01f898ae6f
@ -62,7 +62,7 @@ void parseOptions(int argc, char** argv)
|
||||
ValueArg<double> ftest("f", "floatTest", "float test", false, 3.7, "float");
|
||||
cmd.add( ftest );
|
||||
|
||||
UnlabeledValueArg<string> utest("unTest","unlabeld test",
|
||||
UnlabeledValueArg<string> utest("unTest","unlabeld test", true,
|
||||
"default","string");
|
||||
cmd.add( utest );
|
||||
|
||||
|
@ -44,11 +44,11 @@ void parseOptions(int argc, char** argv)
|
||||
"string");
|
||||
cmd.add( stest );
|
||||
|
||||
UnlabeledValueArg<string> utest("unTest1","unlabeled test one",
|
||||
UnlabeledValueArg<string> utest("unTest1","unlabeled test one", true,
|
||||
"default","string");
|
||||
cmd.add( utest );
|
||||
|
||||
UnlabeledValueArg<string> ztest("unTest2","unlabeled test two",
|
||||
UnlabeledValueArg<string> ztest("unTest2","unlabeled test two", true,
|
||||
"default","string");
|
||||
cmd.add( ztest );
|
||||
|
||||
|
@ -31,7 +31,7 @@ int main(int argc, char** argv)
|
||||
iallowed.push_back(3);
|
||||
ValuesConstraint<int> iallowedVals( iallowed );
|
||||
|
||||
UnlabeledValueArg<int> intArg("times","Number of times to print",1,
|
||||
UnlabeledValueArg<int> intArg("times","Number of times to print",true,1,
|
||||
&iallowedVals,false);
|
||||
cmd.add( intArg );
|
||||
|
||||
|
@ -42,10 +42,10 @@ void parseOptions(int argc, char** argv)
|
||||
ValueArg<string> stest("s", "stringTest", "string test", true, "homer",
|
||||
"string", cmd );
|
||||
|
||||
UnlabeledValueArg<string> utest("unTest1","unlabeled test one",
|
||||
UnlabeledValueArg<string> utest("unTest1","unlabeled test one", true,
|
||||
"default","string", cmd );
|
||||
|
||||
UnlabeledValueArg<string> ztest("unTest2","unlabeled test two",
|
||||
UnlabeledValueArg<string> ztest("unTest2","unlabeled test two", true,
|
||||
"default","string", cmd );
|
||||
|
||||
MultiArg<int> itest("i", "intTest", "multi int test", false,"int", cmd );
|
||||
@ -53,8 +53,8 @@ void parseOptions(int argc, char** argv)
|
||||
MultiArg<float> ftest("f", "floatTest", "multi float test", false,"float",
|
||||
cmd );
|
||||
|
||||
UnlabeledMultiArg<string> mtest("fileName","file names","fileNameString",
|
||||
cmd);
|
||||
UnlabeledMultiArg<string> mtest("fileName","file names",
|
||||
"fileNameString", cmd);
|
||||
//
|
||||
// Parse the command line.
|
||||
//
|
||||
|
@ -21,6 +21,10 @@ int main(int argc, char** argv)
|
||||
MultiSwitchArg noise("N","noise","Level of noise",5);
|
||||
cmd.add( noise );
|
||||
|
||||
UnlabeledValueArg<string> word("word","a random word", false, "string",
|
||||
"won't see this",false);
|
||||
cmd.add( word );
|
||||
|
||||
cmd.parse( argc, argv );
|
||||
|
||||
bool reverseName = reverseSwitch.getValue();
|
||||
@ -36,6 +40,8 @@ int main(int argc, char** argv)
|
||||
if ( noise.isSet() )
|
||||
cout << "Noise level: " << noise.getValue() << endl;
|
||||
|
||||
if ( word.isSet() )
|
||||
cout << "Word: " << word.getValue() << endl;
|
||||
|
||||
} catch (ArgException &e) // catch any exceptions
|
||||
{ cerr << "error: " << e.error() << " for arg " << e.argId() << endl; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user