Tim Foster wrote: > On Thu, 2008-10-09 at 22:40 -0700, Alex Peng wrote: >> 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]" >> ...... > > Mark Musante already wrote a bash autocomplete script: > http://www.sun.com/bigadmin/scripts/sunScripts/zfs_completion.bash.txt > > Cyril Plisko has a tcsh autocomplete script: > http://unixconsult.org/zfs_tcsh_completion > > - a ksh93 one would be nice if anyone knows of one? > > I'm not sure baking this support into the zfs utilities is the right way > to go. None of the other Solaris commands do this sort of > auto-completion, do they?
Not only is it not the "right way" it actually isn't possible. The program that is running at the time is the users shell there is no ZFS code running at the point the user hits the TAB key and depending on what they press after TAB there might never be any ZFS code run. Some Solaris commands do have things like history and the like "in" them but those are interactive commands: like mdb, zonecfg etc. The zfs commands don't follow that model. For this to work for zfs the model would be like this: $ zfs zfs> list -t snapshot ..... zfs> clone tank/[EMAIL PROTECTED] tank/bar zfs> But that isn't how zfs(1) works. This is exactly the same as the age old discussion about where '*' expansion happens. In UNIX systems is is the shell (unless it is quoted) but on MS-DOS it happened in the commands them selves. -- Darren J Moffat _______________________________________________ zfs-discuss mailing list zfs-discuss@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/zfs-discuss