Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Jan 2015 04:10:04 +0100
From:      Stephen Riehm <freebsd@opensauce.de>
To:        =?windows-1252?Q?Michael_Gr=FCnewald?= <michipili@gmail.com>
Cc:        questions@freebsd.org, Polytropon <freebsd@edvax.de>
Subject:   Re: TCSH completion patterns and the pkg command
Message-ID:  <0BD26196-094C-48A3-BAAE-80F753658EF3@opensauce.de>
In-Reply-To: <54A8836D.1010805@gmail.com>
References:  <54A85003.3000301@gmail.com> <20150103203734.5086dfd6.freebsd@edvax.de> <54A8836D.1010805@gmail.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
Hi guys,

>> 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.

Wise words :-)

> I am not sure it easier to do so.  If we consider the special
> example of git:
>=20
> * We have several possible sort of completion lists:
>  remotes, branch names, tags, and commit hashs =97 the latter
>  are commonly used for git commit --fixup et al.
> * We have a lot of subcommands having many options whose names
>  sometimes collide and do not always use the same arguments
>  (e.g. git diff -b and git checkout -b).
>=20
> It seems to me that it is very hard to propose pertinent
> completions for git if we do not take the current subcommand
> into account =97 but frankly, I did not try very hard.

You're right that the "<utility> [options] <command> [options] <args>"
style which has emerged in recent years is not what most completion
systems were designed to cope with, and to be honest, you'd need a =
database
to handle all of the *valid* combinations in many cases... also, the =
more
the shell tries to complete, the more easily it can be confused.
(e.g. git push 'v' git pull, "git p<tab>" is no longer enough, and
even "git pu<tab>" needs extra correction - and once you've typed "pus"
or "pul" completion doesn't help you any more either - it's still one
more key-stroke)

As is so often the case, you can try for perfect, or you can be happy
with 'good enough' or even 'works for me' :-)

In this case, grep through your history and see which commands and =
options you
use a lot and focus on them.

I've been using some custom tcsh completions and scripts to help
improve my git command line experience for a few years now,=20
(but not pkg etc.). Rather than just waving my hands in the air, I've =
pulled
them together and put them up on github for your perusal.
If you're interested, you can find them at =
https://github.com/cobber/git-tools

Perhaps there's some ideas in there to help you put together something =
for pkg.

Cheers,

Steve=



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?0BD26196-094C-48A3-BAAE-80F753658EF3>