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

Allow commands to access the Cli class #10

Open
grkvlt opened this issue May 15, 2012 · 2 comments
Open

Allow commands to access the Cli class #10

grkvlt opened this issue May 15, 2012 · 2 comments

Comments

@grkvlt
Copy link

grkvlt commented May 15, 2012

The command should be able to either access the Cli instance to allow them to either cause the help/usage text to be displayed, or to cause the program to exit with a specific message and status.

@dain
Copy link
Owner

dain commented May 15, 2012

The design of the CLI ends at once the command line is parsed and the command object is created. I chose this line because everyone seems to have a different idea of how actual execution should occur (especially around output messages and exit codes).

Using the current design your command objects could implement an interface with a method like this:

  int run(CLI cli);

As for help specifically, your commands can add a field @Inject Help help to get a reference to the help system.

Does this design work for you?

@grkvlt
Copy link
Author

grkvlt commented May 16, 2012

I hadn't noticed the @Inject Help help; reference before, that should do what I need.

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

No branches or pull requests

2 participants