From: Ulf L. (P. Group) <ulf...@pt...> - 2020-07-29 14:59:03
Attachments:
TestProg.cpp
|
Hi, Attached is a test program that I threw together to evaluate tclap for our needs. However, if I run the command line (checkd Windows only, I think, but this should not matter) TestProg.exe -r -s -s -s -i 42 -m 10.0 -m 2.0 blah Tclap returns an error. Apparently, the last word is not parsed correctly as a parameter. Adding a "--" TestProg.exe -r -s -s -s -i 42 -m 10.0 -m 2.0 -- blah makes the command line valid, but now "blah" is not parsed as a positional argument. The examples are a bit contrived due to me just playing around, but should probably be within reach of what tclap wants to offer. Regards, Ulf |
From: Daniel A. <dan...@gm...> - 2020-07-29 16:42:58
|
Looks like you never added the unlabeled arg to the parser: If you add cmdLine.add(unlabeledArg); before you call parse, it should work. On Wed, Jul 29, 2020 at 5:37 PM Ulf LORENZ (PTV Group) < ulf...@pt...> wrote: > Hi, > > Attached is a test program that I threw together to evaluate tclap for our > needs. However, if I run the command line > (checkd Windows only, I think, but this should not matter) > > TestProg.exe -r -s -s -s -i 42 -m 10.0 -m 2.0 blah > > Tclap returns an error. Apparently, the last word is not parsed correctly > as a parameter. Adding a "--" > > TestProg.exe -r -s -s -s -i 42 -m 10.0 -m 2.0 -- blah > > makes the command line valid, but now "blah" is not parsed as a positional > argument. > The examples are a bit contrived due to me just playing around, but should > probably be within reach of what tclap wants to offer. > > > Regards, > Ulf > _______________________________________________ > Tclap-discuss mailing list > Tcl...@li... > https://lists.sourceforge.net/lists/listinfo/tclap-discuss > |
From: Ulf L. (P. Group) <ulf...@pt...> - 2020-07-30 06:26:09
|
You are right, bad oversight on my part. Thanks, Ulf From: Daniel Aarno <dan...@gm...> Sent: Wednesday, July 29, 2020 6:43 PM To: Ulf LORENZ (PTV Group) <ulf...@pt...> Cc: tcl...@li... Subject: Re: [Tclap-discuss] Invalid parsing of command line Looks like you never added the unlabeled arg to the parser: If you add cmdLine.add(unlabeledArg); before you call parse, it should work. On Wed, Jul 29, 2020 at 5:37 PM Ulf LORENZ (PTV Group) <ulf...@pt...<mailto:ulf...@pt...>> wrote: Hi, Attached is a test program that I threw together to evaluate tclap for our needs. However, if I run the command line (checkd Windows only, I think, but this should not matter) TestProg.exe -r -s -s -s -i 42 -m 10.0 -m 2.0 blah Tclap returns an error. Apparently, the last word is not parsed correctly as a parameter. Adding a "--" TestProg.exe -r -s -s -s -i 42 -m 10.0 -m 2.0 -- blah makes the command line valid, but now "blah" is not parsed as a positional argument. The examples are a bit contrived due to me just playing around, but should probably be within reach of what tclap wants to offer. Regards, Ulf _______________________________________________ Tclap-discuss mailing list Tcl...@li...<mailto:Tcl...@li...> https://lists.sourceforge.net/lists/listinfo/tclap-discuss |
From: Daniel A. <dan...@gm...> - 2020-07-31 12:40:42
|
To make this easier, you can simply pass the cmd line object to the arg definition - that's typically what I do: http://tclap.sourceforge.net/manual.html#ARG_ADD_CMDLINE On Thu, Jul 30, 2020 at 7:25 AM Ulf LORENZ (PTV Group) < ulf...@pt...> wrote: > You are right, bad oversight on my part. > > > > Thanks, > > Ulf > > > > *From:* Daniel Aarno <dan...@gm...> > *Sent:* Wednesday, July 29, 2020 6:43 PM > *To:* Ulf LORENZ (PTV Group) <ulf...@pt...> > *Cc:* tcl...@li... > *Subject:* Re: [Tclap-discuss] Invalid parsing of command line > > > > Looks like you never added the unlabeled arg to the parser: > > > > If you add cmdLine.add(unlabeledArg); before you call parse, it should > work. > > > > On Wed, Jul 29, 2020 at 5:37 PM Ulf LORENZ (PTV Group) < > ulf...@pt...> wrote: > > Hi, > > Attached is a test program that I threw together to evaluate tclap for our > needs. However, if I run the command line > (checkd Windows only, I think, but this should not matter) > > TestProg.exe -r -s -s -s -i 42 -m 10.0 -m 2.0 blah > > Tclap returns an error. Apparently, the last word is not parsed correctly > as a parameter. Adding a "--" > > TestProg.exe -r -s -s -s -i 42 -m 10.0 -m 2.0 -- blah > > makes the command line valid, but now "blah" is not parsed as a positional > argument. > The examples are a bit contrived due to me just playing around, but should > probably be within reach of what tclap wants to offer. > > > Regards, > Ulf > _______________________________________________ > Tclap-discuss mailing list > Tcl...@li... > https://lists.sourceforge.net/lists/listinfo/tclap-discuss > > |