On 10/10/2008, at 5:12 PM, Nathan Kroenert wrote:
> On 10/10/08 05:06 PM, Boyd Adamson wrote:
>> Alex Peng <[EMAIL PROTECTED]> writes:
>>> Is it fun to have autocomplete in zpool or zfs command?
>>>
>>> For instance -
>>>
>>>    "zfs cr 'Tab key' " will become "zfs create"
>>>    "zfs clone 'Tab key' " will show me the available snapshots
>>>    "zfs set 'Tab key' " will show me the available properties,  
>>> then "zfs set com 'Tab key'" will become "zfs set compression=",   
>>> another 'Tab key' here would show me "on/off/lzjb/gzip/gzip-[1-9]"
>>>    ......
>>>
>>>
>>> Looks like a good RFE.
>> This would be entirely under the control of your shell. The zfs and
>> zpool commands have no control until after you press enter on the
>> command line.
>> Both bash and zsh have programmable completion that could be used  
>> to add
>> this (and I'd like to see it for these and other solaris specific
>> commands).
>> I'm sure ksh93 has something similar.
>> Boyd
> Hm -
>
> This caused me to ask the question: Who keeps the capabilities in  
> sync?
>
> Is there a programmatic way we can have bash (or other shells)  
> interrogate zpool and zfs to find out what it's capabilities are?
>
> I'm thinking something like having bash spawn a zfs command to see  
> what options are available in that current zfs / zpool version...
>
> That way, you would never need to do anything to bash/zfs once it  
> was done the first time... do it once, and as ZFS changes, the  
> prompts change automatically...
>
> Or - is this old hat, and how we do it already? :)
>
> Nathan.

I can't speak for bash, but there are certainly some completions in  
zsh that do this kind of thing. I'm pretty sure there is some  
completion code that runs commands gnu-style with --help and then  
parses the output.

As long as there is a reliable and regular way to query the  
subcommands I think it's reasonable.

(Personally I'd like to see a more general and complete way for  
commands to provide completion info to shells, either in a separate  
file of some sort or by calling them in a certain way, but that's a  
pipe dream I fear)

Boyd
.. who has a vague feeling that that's how it worked for DCL on VMS


_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to