Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Program Options #5

Closed
Rapptz opened this issue Aug 20, 2013 · 5 comments
Closed

Program Options #5

Rapptz opened this issue Aug 20, 2013 · 5 comments

Comments

@Rapptz
Copy link
Owner

Rapptz commented Aug 20, 2013

Command line parsing utility. Something akin to Boost.ProgramOptions except in modern C++11.

@Rapptz
Copy link
Owner Author

Rapptz commented Oct 26, 2013

This has been implemented to a certain extent in the develop branch but the only thing it doesn't have is positional arguments (though it does have required arguments). Maybe in another revision it'll be expanded upon with a better design and API since the design itself isn't final. Just throwing some thoughts out there for me to list.

@Rapptz Rapptz closed this as completed Oct 27, 2013
@Rapptz
Copy link
Owner Author

Rapptz commented Dec 14, 2013

I decided it doesn't really belong in gears. If anything it'll probably be in its own repository.

@Rapptz
Copy link
Owner Author

Rapptz commented Jul 18, 2014

This is being worked on (again) under a different module name: optparse. A new branch was made for the development named with little originality: optparse. At the moment the current main design goals I've decided on are the following:

  • Flags must be of syntax --opt or -o
  • Short aliases can be concatenated, e.g. -o -a -v to -oav
    • This is equivalent to -o=1 -a=1 -v=1
  • To specify values an equal sign can be provided,
    e.g. --opt=10 or -o=10
  • If a value is not specified (such as -o --opt) it is equivalent
    to doing -o=1 --opt=1
  • Flag syntax should not be allowed to be changed. The windows version of switches (i.e. /)
    doesn't work very well with Linux.
  • Must be able to add arguments easily
  • Must allow lists to be specified, e.g. --list 1 2 3 or --list=1,2,3 with key-value syntax.
  • Able to easily get the rest of the arguments
  • Able to easily check if an argument exists
  • Should be able to change the option parser for an option
  • Should be able to retrieve an option object from the parser
  • Should allow subcommands such as git commit, git add, etc
  • If argv[1] isn't a subcommand, then this should be transparent
    to the user and developer since there's no reason to make the API more complicated.
  • Provide a raw_parse and a parse member function which
    doesn't handle errors and handles errors respectively.
  • The --help flag should be automatically provided.
  • Provide a formatter class which will allow to change the formatting of the help and usage message.
  • Registering callbacks is not allowed since that'll make the code more complicated for little benefit.

@Rapptz Rapptz reopened this Jul 18, 2014
@ThePhD
Copy link

ThePhD commented Jul 18, 2014

-- or - should be optional. They should default to that, but someone should be able to provide a start sequence and/or a long start sequence string.

That's all my 2 cents.

@Rapptz Rapptz removed the new module label Jul 27, 2014
@Rapptz
Copy link
Owner Author

Rapptz commented Jul 31, 2014

Implemented as of 4f635c7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants