From owner-freebsd-current@FreeBSD.ORG Fri Oct 19 16:21:07 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 44FE3128; Fri, 19 Oct 2012 16:21:07 +0000 (UTC) (envelope-from admin@lissyara.su) Received: from mx.lissyara.su (mx.lissyara.su [91.227.18.11]) by mx1.freebsd.org (Postfix) with ESMTP id 674468FC16; Fri, 19 Oct 2012 16:21:06 +0000 (UTC) Received: from [77.41.108.0] (port=20890 helo=dc7700p.lissyara.su) by mx.lissyara.su with esmtpa (Exim 4.80 (FreeBSD)) (envelope-from ) id 1TPFJn-0008s5-VK; Fri, 19 Oct 2012 20:21:03 +0400 Message-ID: <50817DEF.4070509@lissyara.su> Date: Fri, 19 Oct 2012 20:21:03 +0400 From: Alex Keda User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:16.0) Gecko/20121019 Thunderbird/16.0.1 MIME-Version: 1.0 To: Chris Rees Subject: Re: [HEADSUP] current switched by default to pkgng References: <20121010134421.GI26497@ithaqua.etoilebsd.net> <5081661B.2090209@lissyara.su> <50816D59.1030706@unsane.co.uk> <50816EE5.8090704@lissyara.su> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Description: if spam count > 60 - this is spam X-Spam-Count: 0 X-Descriptions: powered by www.lissyara.su X-Bounce-ID: mx.lissyara.su Cc: ports@freebsd.org, Baptiste Daroussin , current@freebsd.org, Vincent Hoffman X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Oct 2012 16:21:07 -0000 On 19.10.2012 19:59, Chris Rees wrote: > On 19 October 2012 16:16, Alex Keda wrote: >> On 19.10.2012 19:10, Vincent Hoffman wrote: >>> On 19/10/2012 15:39, Alex Keda wrote: >>>> pkg command does not have key for list options - no autocompletions >>>> >>>> for example, for service command, I use >>>> complete service 'n/*/`service -l`/' >>>> in .cshrc >>>> >>>> what I can use for pkg command? >>> >>> horrible but working example >>> pkg help 2>&1 | sed -e '1,/Commands supported:/d ; /For more information >>> on the different commands/,$d; s/^ *// ; s/ .*.*$// ;/^$/d' >>> >>> There's bound to be better ways, I was just bored enough to knock this up. >>> note s/^ *// is a tab, while s/ .*.*$// is 2 spaces >>> dont think our sed has any other way to express tab other than an actual >>> tab (ctrl-v then tab on the command line) >> >> it's crazy =) >> may be add -l options? > > For Bourne-style shell: > `pkg help 2>&1 | sed -nE 's,^ +(.*),\1,p'` > > For csh-style shell: > `pkg help | & sed -nE 's,^ +(.*),\1,p'` > > where the bit between ^ and + is a tab character. You can type the > tab character on a command prompt by using Ctrl+V then tab, or just > type it normally in the script. > > Hope that helps in the meantime. > > Chris > dc7700p# pkg -c Displays Performs a and check debug from inside local package packages remote search system updating -d Displays Performs a and ......... skipped ........ Displays Opens a against catalogues debug from inside link package packages register search system update dc7700p# dc7700p# grep pkg /root/.cshrc complete pkg 'n/*/`pkg help |& sed -nE "s,^ +(.*),\1,p"`/' some not work... I try my own string: complete pkg 'n/*/`pkg help |& grep "Commands supported:" --after-context=100 | grep "^\s" | awk "{print $1}"`/' output identical. maybe pipe not work in this place?