Improve shell behaviour for commands invoked with invalid arguments
Project: | JNode Shell |
Component: | Code |
Category: | feature request |
Priority: | normal |
Assigned: | Unassigned |
Status: | closed |
Jump to:
Description
If the user invokes a command with invalid arguments print information which helps the user in fixing the problem.
More speciffically if the command input is partially correct try to guess what's wrong and make an advice to the user.
If a command which needs one or more arguments but it's invoked with no arguments print out the usage information of the command which is the "Usage:" section of the output of the help information of this command, then advice the user to type "help command" for more information. This would be the desired behaviour also when on a partially correct argument set it's not possible to make an educated guess about the nature of problem in the command arguments.
- Login to post comments
#1
I wasn't going to comment on this for now, but an email has prompted to do so.
Firstly, I think that the current JNode shell/syntax infrastructure is already a lot better than UNIX / Linux shells in terms of usability for new users:
Second, current thinking is that command-line stuff is really only for "power users". I wish this wasn't the case, but sadly most computer users will run a mile if you don't give them dumbed down point and click interfaces. What this means that we can probably rely on JNode shell users being willing to run "help" and read online command documentation. (Call me old fashioned ... but this approach was just fine for me when I learned to use UNIX.)
Now to some specifics:
If I was going to do anything in this area, I'd try to do it by adding new methods to the "CommandCompleter" API which would bind to some currently un-bound control key. For example: CTRL-U might mean "display usage". But I wouldn't try the more complicated stuff. It would be very difficult and IMO the results would at best be mediocre.
#2
As I suggested, if you think making a guess is too hard in the current command argument parsing system then printing out the usage info is still better than a generic and nothing-telling error message.
#3
I disagree. You are presuming that the user wants to see a usage message every time he / she gets the command line syntax incorrect. I would find that kind of behavior annoying.
If I want to see usage information, I'm happy to type "help <command>" or "usage <command>", or "<command> ^U" or ...
But I really think that there are more important things to fix.
#4
I have implemented a simple incremental help mechanism.
If you enter a partial command (with a complete alias / classname) followed by ESC or CTRL-?, the shell will now display the command's usage message(s). If the command line is a pipeline, the usage for the last command is shown. (This is implemented for the 'default' and 'redirecting' interpreters ... not the 'bjorne' interpreter yet)
I'm marking this issue fixed as I don't intend to implement any of the other ideas for the reasons previously stated.
#5
Automatically closed -- issue fixed for two weeks with no activity.