Skip to content

Automatic help when execute method not defined. #52

Open
@dh3014

Description

@dh3014

my first concrete service looks like:

mb scheduled-job insert [arg1] [arg2] 

When I typed

mb

it automatically triggered HelpCommand and displayed help message, which is great since I then knew the application 'mb' has 2 commands 'scheduled-job' and 'help' as well as a brief description.

However when I further typed

 mb scheduled-job

it ends up showing nothing but a blank line. I trace the code found an ExecuteMethodNotDefinedException is thrown with no message, first I think I can add a helpful message when throwing this exception, second I thought it might be more consistent to catch this specific type of Exception in Application::runWithTry()

What I really want in the end, is the framework will show help message, with list of possible sub-commands. See if you think this is worth merging to the master branch.

If you agree then we can further discuss the detail a bit, my first glance is to add this feature in base Application::run(), one way is to catch ExecuteMethodNotDefinedException here then shows help message here if possible (if not possible, maybe just bubbles up the Exception so runWithTry() will display a helpful error message)

The other way is b4 we throw the Exception in Application::executeWrapper(), we check if showing help message is possible (sub-commands exist).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions