On 7/4/09 11:42 AM, Derek Baum wrote:
2009/7/4 Richard S. Hall<[email protected]>
Of course, this has implications, because it means you are either do not
generally reuse the same command name for different purposes or use the
command/subcommand approach (like with "obr list").
In the latter case, it could be convenient, I suppose if "obr list" were
treated as a scope and command separated by a space, otherwise obr would end
up having a scope and then a command/subcommand.
I like this idea - if the command name matches a known scope, then execute
the next argument as a command in that scope. This also makes creating
commands with sub-commands no different than other commands.
However, we'd need to define what should happen if 'obr' is typed without a
sub-command - it could try to execute obr:help or obr:default if they exist,
or just give a 'sub-command not found' error.
You could define closely related obr commands and loosely related posix
commands in the same way
(i.e. there is no need to add extra logic to the obr command to handle
sub-commands):
obr:list
obr:add
etc
posix:grep
posix:ls
etc
You can then choose how you want to invoke them:
1. explicitly - obr:list, posix:grep
2. using your proposal - 'obr list', 'posix grep'
3. using SCOPE=posix:* - allows typing just 'grep' or 'ls'
4. Just type 'grep'.
Right? If all scopes are searched and since 'grep' is unique, then I
shouldn't need to type anything else, nor should I have to change the scope.
-> richard
You could also set SCOPE=obr:*, which would allow you to just type 'list'
and 'add' for obr commands,
but this is probably less useful as the obr command names are more likely to
collide with other scopes.
Derek
-> richard