Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Jan 2015 20:37:34 +0100
From:      Polytropon <freebsd@edvax.de>
To:        Michael =?UTF-8?B?R3LDvG5ld2FsZA==?= <michipili@gmail.com>
Cc:        questions@freebsd.org
Subject:   Re: TCSH completion patterns and the pkg command
Message-ID:  <20150103203734.5086dfd6.freebsd@edvax.de>
In-Reply-To: <54A85003.3000301@gmail.com>
References:  <54A85003.3000301@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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:
> 
>    https://github.com/michipili/tcshfiles/commit/9caf67c

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.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150103203734.5086dfd6.freebsd>