From owner-freebsd-questions@FreeBSD.ORG Sun Jan 4 05:09:49 2015 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 03626E68 for ; Sun, 4 Jan 2015 05:09:49 +0000 (UTC) Received: from wonkity.com (wonkity.com [67.158.26.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "wonkity.com", Issuer "wonkity.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id A840F3247 for ; Sun, 4 Jan 2015 05:09:48 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.9/8.14.9) with ESMTP id t0459XPb039831 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 3 Jan 2015 22:09:33 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.9/8.14.9/Submit) with ESMTP id t0459WMS039828; Sat, 3 Jan 2015 22:09:32 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Sat, 3 Jan 2015 22:09:32 -0700 (MST) From: Warren Block To: =?ISO-8859-15?Q?Michael_Gr=FCnewald?= Subject: Re: TCSH completion patterns and the pkg command In-Reply-To: <54A8836D.1010805@gmail.com> Message-ID: References: <54A85003.3000301@gmail.com> <20150103203734.5086dfd6.freebsd@edvax.de> <54A8836D.1010805@gmail.com> User-Agent: Alpine 2.11 (BSF 23 2013-08-11) MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (wonkity.com [127.0.0.1]); Sat, 03 Jan 2015 22:09:33 -0700 (MST) Content-Type: TEXT/PLAIN; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 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 05:09:49 -0000 On Sun, 4 Jan 2015, Michael Grünewald wrote: > Polytropon wrote: >> The C shell is the system's _default_ interactive shell. >> This statement does not carry any judgmental statement. :-) > > I was not sure any more about this, so I went lazy and blurry. :) > >> 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. > > I am not sure it easier to do so. If we consider the special > example of git: > > * We have several possible sort of completion lists: > remotes, branch names, tags, and commit hashs ? 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). > > 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 ? but frankly, I did not try very hard. Some completions here, including some moderate ones for pkg: http://www.wonkity.com/~wblock/csh/completions From owner-freebsd-questions@FreeBSD.ORG Sun Jan 4 05:54:24 2015 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A8BD24BF for ; Sun, 4 Jan 2015 05:54:24 +0000 (UTC) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3CC8F6493E for ; Sun, 4 Jan 2015 05:54:23 +0000 (UTC) Received: from r56.edvax.de (port-92-195-85-165.dynamic.qsc.de [92.195.85.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPS id 3888E3CD85; Sun, 4 Jan 2015 06:54:19 +0100 (CET) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id t045sJg7002009; Sun, 4 Jan 2015 06:54:19 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Sun, 4 Jan 2015 06:54:19 +0100 From: Polytropon To: Warren Block Subject: Re: TCSH completion patterns and the pkg command Message-Id: <20150104065419.964edb45.freebsd@edvax.de> In-Reply-To: References: <54A85003.3000301@gmail.com> <20150103203734.5086dfd6.freebsd@edvax.de> <54A8836D.1010805@gmail.com> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Michael =?ISO-8859-1?Q?Gr=FCnewald?= , questions@freebsd.org 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 05:54:24 -0000 On Sat, 3 Jan 2015 22:09:32 -0700 (MST), Warren Block wrote: > On Sun, 4 Jan 2015, Michael Gr=FCnewald wrote: >=20 > > Polytropon wrote: > >> The C shell is the system's _default_ interactive shell. > >> This statement does not carry any judgmental statement. :-) > > > > I was not sure any more about this, so I went lazy and blurry. :) > > > >> 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. > > > > I am not sure it easier to do so. If we consider the special > > example of git: > > > > * We have several possible sort of completion lists: > > remotes, branch names, tags, and commit hashs ? 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). > > > > 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 ? but frankly, I did not try very hard. >=20 > Some completions here, including some moderate ones for pkg: > http://www.wonkity.com/~wblock/csh/completions Your completition suggestion was the one I've been refering to. It's very nicely done, but of course it won't be possible to cope with all imaginable combinations of commands and subcommands and their specific options. Trying to have all all of them autocompleted, plus the many GNU long style options, would probably too much for a shell - and the main- tainer of the completition list to always keep it current and valid. :-) Anyway, your list (and the comment header explaining the syntax) is a good base to build on. In the special case of "git push" and "git pull" which are fully equivalent up to the 's' or 'l', it could be possible to alias them, where the alias is "earlier unambiguous", and then have that alias autocompleted. Here a combination of aliases and completition patterns could work more reliably than just completition. It is, however, debatable in how far this should be part of the OS preconfiguration. I'm happy about the C shell now having adopted a normal UNIX prompt, but I wouldn't assume that everyone on earth would be happy with my ls defaults as _his_ defaults: % grep -i ls /etc/csh.cshrc | less alias ls 'ls -FG -D "%Y-%m-%d %H:%M:%S"' alias ll 'ls -laFG -D "%Y-%m-%d %H:%M:%S"' setenv LSCOLORS ExGxdxdxCxDxDxBxBxege :-) --=20 Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...