felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Derek Baum <derek.b...@paremus.com>
Subject Re: [gogo] Advanced commands / console
Date Sat, 04 Jul 2009 15:42:09 GMT
2009/7/4 Richard S. Hall <heavy@ungoverned.org>

> I don't have an issue with have a PATH-like concept, but by default all
> "scopes" should be on the path unless otherwise specified. I don't want to
> be forced into dynamically managing my PATH variable for every set of
> commands I want to use.

Yes, all scopes are searched by default.

If SCOPE is not set, then it defaults to "osgi:*", which first searches the
osgi: scope, then all other scopes.
The commands are stored in a HashMap, so if an explicit scope is not given
and multiple commands are registered, then you don't know which one you'll

Note: RFC-132 does not currently define the commands that shoulkd be in the
osgi: scope

> 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



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'

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.


> -> richard

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message