dev@glassfish.java.net

Re: target as option or operand?

From: Hong Zhang <hong.hz.zhang_at_oracle.com>
Date: Sat, 26 Jun 2010 20:47:26 -0400

Hi, Jane
>>> I noticed some commands take target operand, and others take target
>>> options. What's the rules for providing target value?
>>>
>>> For ex:
>>>
>>> asadmin list-components --target cluster1 (Failed as option)
>>> Invalid option: --target
>>>
>>> asadmin list-components cluster1 (Passed as operand)
>>> Command list-components executed successfully on server instance
>>> instance1
>>> Command list-components executed successfully on server instance
>>> instance2
>> Yes, I have implemented the list-components command to be v2 backward
>> compatible (though like Bill I am not sure why it was operand instead
>> of an option).
> Here's an usability question:
>
> Is it easier to type: "list-components cluster1" or "list-components
> --target cluster1"?
It is easier to type "list-components cluster1" but it's more intuitive
(at least to me) to type "list-components --target cluster1" as the
target was used as an option in other commands like deploy, undeploy. :-)
> For list-components command, it's possible to have --target as the
> option and --type as the operand. But back in pre-v2 time, the deploy
> command had --type as an option so to be compatible, --type became
> an option and target was made as an operand. Not sure if I diverge
> from the original question. But want to point out the history behind
> why target became an operand in list-components.
Do we have to have an operand for our cli commands? If yes, I guess I
see why target is used as the operand. But unix commands like "ls" don't
have an operand.
In any case, as we already have this syntax in v2, we should just keep
backward compatibility in 3.1. :-)

Thanks,

- Hong

>
>>> (The doc says for list-components, the target operand is deprecated
>>> and ignored. But it turns out it's still significant)
>> Where do you see this? We should change this to say the same thing as
>> v2 doc as we are implementing the same way.
>>
>> Thanks,
>>
>> - Hong
>>>
>>>
>>> asadmin list-jndi-resources --target cluster1 (Passed as option)
>>> Command list-jndi-resources executed successfully on server instance
>>> instance1
>>> Command list-jndi-resources executed successfully on server instance
>>> instance2
>>>
>>> asadmin list-jndi-resources cluster1 (Failed as operand)
>>> Command list-jndi-resources does not accept any operands
>>>
>>> Thanks,
>>> -cheng
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>