From owner-freebsd-questions@FreeBSD.ORG Sun Jan 4 03:10:13 2015 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CDA06431 for ; Sun, 4 Jan 2015 03:10:13 +0000 (UTC) Received: from smtprelay03.ispgateway.de (smtprelay03.ispgateway.de [80.67.31.30]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8DA2812BA for ; Sun, 4 Jan 2015 03:10:12 +0000 (UTC) Received: from [79.225.199.229] (helo=max2.muc.opensauce.de) by smtprelay03.ispgateway.de with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.84) (envelope-from ) id 1Y7bZs-00022Z-EM; Sun, 04 Jan 2015 04:10:04 +0100 Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: TCSH completion patterns and the pkg command From: Stephen Riehm In-Reply-To: <54A8836D.1010805@gmail.com> Date: Sun, 4 Jan 2015 04:10:04 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <0BD26196-094C-48A3-BAAE-80F753658EF3@opensauce.de> References: <54A85003.3000301@gmail.com> <20150103203734.5086dfd6.freebsd@edvax.de> <54A8836D.1010805@gmail.com> To: =?windows-1252?Q?Michael_Gr=FCnewald?= X-Mailer: Apple Mail (2.1878.6) X-Df-Sender: Mjg4MTc3 Cc: questions@freebsd.org, Polytropon X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Jan 2015 03:10:13 -0000 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 " [options] [options] " 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" is no longer enough, and even "git pu" 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=