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