Different arguments format

Help
evgenka
2007-11-15
2013-05-28
  • evgenka

    evgenka - 2007-11-15

    Hi,
    Is there a convenient way to customize the arguments format?
    To be more specific, I need them to be recognized without the "-" prefix,
    like:
        cmd source=blah1 target=blah2

    Thanks,
       Evgeny

     
    • Mike Smoot

      Mike Smoot - 2007-11-16

      I completely expected to reply to your message that no, this is impossible.  HOWEVER, I tried a few things and it seems to work. 

      Mind you, this isn't "easy" as you'll need to edit the tclap source.  Also, I've got to say that I really, REALLY discourage this as I am certain that there are corner cases where things will break or you'll get unexpected results. Especially if your arguments are at all complicated.

      That said....

      You need to edit your copy of Arg.h and make the following changes:

      1. Change
      static const std::string flagStartString() { return "-"; }
      to
      static const std::string flagStartString() { return ""; }

      2. Change
      static const std::string nameStartString() { return "--"; }
      to
      static const std::string nameStartString() { return ""; }

      3. Comment out all of the checks in the Arg constructor.  If you don't do this, you'll get exceptions pretty quickly. 

      4. That's it?  I don't know, but I was able to get a simple test case working with these changes.

      Good luck!

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks