From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6256 invoked by alias); 24 Jan 2010 11:04:07 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 27636 Received: (qmail 6234 invoked from network); 24 Jan 2010 11:03:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.2.5 Received-SPF: none (ns1.primenet.com.au: domain at bewatermyfriend.org does not designate permitted sender hosts) From: Frank Terbeck To: Peter Cc: zsh-workers@zsh.org Subject: Re: what is the effect of a percentage sign (%) as last character on the command line In-Reply-To: <4B5C180D.8080904@mycircuit.org> (Peter's message of "Sun, 24 Jan 2010 10:51:09 +0100") References: <4B582F3C.2010709@mycircuit.org> <100121080540.ZM21444@torch.brasslantern.com> <4B58AB3A.7050300@mycircuit.org> <2d3b879b1001211336m5b78982au96f267ea472af43d@mail.gmail.com> <4B58D35D.1050208@mycircuit.org> <100121182713.ZM21821@torch.brasslantern.com> <4B597061.10701@mycircuit.org> <100123155239.ZM27228@torch.brasslantern.com> <4B5C180D.8080904@mycircuit.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Date: Sun, 24 Jan 2010 11:58:58 +0100 Message-ID: <87tyubzs3x.fsf@ft.bewatermyfriend.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Df-Sender: 430444 Peter writes: > Yes, sorry , my snippet was too short: > > git_info() { > ref=$(git symbolic-ref -q HEAD 2>/dev/null) > ref=${ref#refs/heads} > echo ${ref:+"${GREEN}[$ref]${WHITE}"} [...] Since you're trying to collect information from version control systems, if you're on zsh 4.3.7 or newer, zsh includes a collection of functions called `vcs_info' which do all the work for you. The thing is pretty configurable, so tweaking it to your liking shouldn't be an issue. It has support for a great number of version control systems; git is among them (and the git backend is probably the one with the most features). If `vcs_info' is included in your zsh version, this should get you to its documentation: % MANPAGER='less -M -p GATHER' man zshcontrib Regards, Frank