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

Customizable usage message / operand specification #27

Closed
morozov opened this issue Feb 27, 2014 · 3 comments
Closed

Customizable usage message / operand specification #27

morozov opened this issue Feb 27, 2014 · 3 comments
Assignees
Milestone

Comments

@morozov
Copy link

morozov commented Feb 27, 2014

For a CLI application with fixed set of operands it'd be useful if it was possible to describe them explicitly in "usage" message. I.e. instead of

Usage: copy [options] [operands]
Options:
  --overwrite             Overwrite existing file

I'd like to have a more meaningful message like

Usage: copy [options] <from> <to> [<optional-operand>]
Options:
  --overwrite             Overwrite existing file

In fact, this example brings the idea of operands specification alongside with the one for options. Like options, operands may also have names, be mandatory or optional and have default values.

@ulrichsg
Copy link
Collaborator

Thanks for your suggestion. It's definitely something I'll consider for a future release.

@tflori
Copy link
Member

tflori commented Jul 21, 2017

with #75 you will be able to define from and to very easy:

$getopt = new Getopt();
$getopt->addOperand(new Operand('from'));
$getopt->addOperand(new Operand('to'));

echo $getopt->getHelpText();

If you want to try it by yourself you can install 3.0.x-dev or dev-feature-operandSpecification

@tflori tflori closed this as completed Jul 21, 2017
@morozov
Copy link
Author

morozov commented Jul 21, 2017

@tflori thank you. I'm currently not working on the project I was asking this for (it's been 3½ years since then). I'll give it a try once I start working on something similar.

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

3 participants