Issue Details (XML | Word | Printable)

Key: ROO-506
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Ben Alex
Reporter: Spencer Uresk
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Spring Roo

Make the user more aware of which commands are possible, but not currently available

Created: 01/Jan/10 03:23 PM   Updated: 22/Jan/10 10:54 PM   Resolved: 22/Jan/10 10:54 PM
Component/s: @ USER INTERFACE
Affects Version/s: 1.0.0.RELEASE
Fix Version/s: 1.0.1.RELEASE

Time Tracking:
Not Specified


 Description  « Hide

While trying Roo out the other day, I ran into a somewhat confusing scenario. I had just created a project that had persistence functionality and wanted to add spring security to it. Running the 'help' command showed no security-related commands, but a Google search showed me that a 'security setup' command should be possible. Running it did nothing, so I figured it had been taken out for whatever reason and went on. A while after creating my first controller, I noticed that the 'security setup' command was now available. A little bit of experimentation confirmed that the security command had a dependency on the web stuff being added.

This causes a few problems:

1) I have no idea what commands might be available.

2) It might be hard to know why a particular command isn't available. In the case of, say, the entity command, it seems fairly obvious that I need to add persistence support before doing so. In other cases, however, it may not be as obvious - it wasn't clear to me upfront that I'd have to have to do something that resulted in a web.xml being created to use Spring Security.

I have a few suggestions for improving this:

1) Show all commands that are currently disabled. This could be done below all of the available commands when you run 'help' or maybe it could be a flag like 'help --hidden-commands'.

2) Where possible, show a reason why the command is unavailable. Ie, for 'security setup', it might say something like "Command Unavailable: Requires a web.xml - create a scaffold or controller first to enable this command."

2) If you try to run a command that is valid, but unavailable, it would be nice if it let you know that it actually was a valid command, but it wasn't available for running (and preferably, why) instead of just saying "not found".

This isn't a huge problem, but it does cause a bit of confusion (especially with first-time users) and it might be nice to make it a little easier to use.

I took a look at the Roo source code and I have some ideas on how to make this work, so I'd be willing to investigate and discuss further and even work on a patch if this is something people are interested in.



Ben Alex added a comment - 22/Jan/10 10:54 PM

Thanks for this suggestion.

'help' will now return all commands, even if they are not presently available.

If a user types a command that is valid but not presently available, a more informative error message will be rendered:

roo> security setup
Command 'security setup' was found but is not currently available (type 'help' then ENTER to learn about this command)

If a user types a command that is simply unknown, the original message will be rendered:

roo> whatever
Command 'whatever' not found (for assistance press TAB or type "hint" then hit ENTER)

Tab completion still hides commands that are not currently available, as one would expect.

Checked into SVN as revision 590.