admin@glassfish.java.net

Re: CLI meta options

From: Lloyd Chambers <Lloyd.Chambers_at_Sun.COM>
Date: Tue, 26 Aug 2008 10:53:44 -0700

'asadmin' is a meta command: a command line for delivering a command
line.

  'asadmin' doesn't have a subcommand. We're thinking about it
wrong. It has only options and operands. Some of its operands start
with "--".

asadmin [options] [operands]
asadmin --debug=true --port 4888 --user foo --password /pwd.txt --
module com.sun.foo.Bar1
      create-stuff --user lloyd --port 9999 --debug --password hello
stuff1

Here, the operand list is "create-stuff --user lloyd --port 9999 --
debug --password hello stuff1". Operands can have arbitrary values
after all.

I had previously written up the CLI syntax proposed changes here:

https://glassfish.dev.java.net/nonav/v3/admin/planning/V3Changes/V3_AdminCLI.html
#SyntaxExtensions

Our module-based system faces additional CLI challenges:

- conflict with sub-command names and options between modules (two
modules both want a 'get' command)

- running two versions of a module, with identical sub-commands

- running independently-developed modules have the same sub-commands


So I envision this sort of useful meta-option structure. Here's and
advanced/worst case which turns on debugging, specifies the module and
the connectivity:

asadmin --debug=true --port 4888 --user foo --password /pwd.txt --
module com.sun.foo.Bar1
      create-stuff --user lloyd --port 9999 --debug --password hello

Here, asadmin has a command line payload of "create-stuff --user lloyd
--port 9999 --debug --password hello".

Note all the option names and the conflicts we avoid by having meta
options.

The same command might apply to the new version of the module, 'Bar2':

asadmin --debug=true --port 4888 --user foo --password /pwd.txt --
module com.sun.foo.Bar2
      create-stuff --user lloyd --port 9999 --debug --password hello

Lloyd



On Aug 20, 2008, at 5:20 PM, Bill Shannon wrote:

> Kedar Mhaswade wrote:
>> Jane,
>> I agree, but what Bill suggested is something that
>> we have been wanting to do for some time. We need to do something
>> to separate the options for the commands from the options for the
>> asadmin program. Currently, a command implementation does not care
>> what the values for:
>> -- host, --port, --passwordfile, --secure, --terse etc. are.
>
> Sort of like cvs:
>
> $ cvs --help
> Usage: cvs [cvs-options] command [command-options-and-arguments]
>
>> All of these are "asadmin program options". A command like create-
>> http-listener
>> does not care about it.
>
> And in multiline mode, you probably shouldn't be able to specify
> these options on individual commands.
>
>> A via-media solution can be reached (more specification required),
>> if we
>> say that a command name can't start with a - or a --. This is
>> intuitive
>> and can take care of our requirement.
>> Again, think of what we want to do with this proposal. I think it
>> is useful.
>> Regards,
>> Kedar
>> PS- BTW, I am not so sure that --target is an asadmin program
>> option. A command
>> does care about what the value of --target is. So, the current
>> discussion is
>> rather unrelated with documentation of --target option.
>
> You're probably right about that.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>