TCSH completion patterns and the pkg command
freebsd at edvax.de
Sat Jan 3 19:37:44 UTC 2015
On Sat, 03 Jan 2015 21:24:35 +0100, Michael Grünewald wrote:
> The C-shell included in the base system is a popular(?) interactive
> shell among FreeBSD users.
The C shell is the system's _default_ interactive shell.
This statement does not carry any judgmental statement. :-)
> Some popular software package such as git or subversion use a small
> variation of this UNIX syntax which, to the best of my knowledge,
> defeats the C-shell:
> command subcommand -a argA -b argB --longopt longarg item1 item2 …
> Today, there is several important commands in FreeBSD using such
> a scheme, such as pkg, pw or gpart.
> Do we have any plans to enhance the C-shell completion features to
> deal nicely with this scheme?
> An easy workaround is to define an alias for each subcommand, I use
> this strategy in my tcshfiles:
In my opinion, this is possible, but not easy. I'd say
it's easier to teach the C shell the completition rules
for the commands you want. Here's an example:
complete gpart 'p/*/(add backup bootcode commit <... more ...>)/'
This should work the same for pkg, pw, svn, git, zfs,
zpool and so on. A similar approach works nicely for dd.
Additionally, you don't have to "pollute" your system
with aliases which only exist for the sake of completition.
> It would however be nicer to have a more capable completion system
> in the C-shell.
It should be no problem if additional settings like those,
when desired by the users' community, would be included
per default in the /etc/csh.cshrc global file.
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions