From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan-Benedict Glaw Subject: Re: [PATCH 1/3] Nicer output from 'git' Date: Thu, 9 Mar 2006 18:14:34 +0100 Message-ID: <20060309171434.GD4297@lug-owl.de> References: <20060309161722.GA4484@c165.ib.student.liu.se> <20060309162419.GB4484@c165.ib.student.liu.se> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BRE3mIcgqKzpedwo" Cc: git@vger.kernel.org, junkio@cox.net X-From: git-owner@vger.kernel.org Thu Mar 09 18:15:01 2006 Return-path: Envelope-to: gcvg-git@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FHOin-0005yi-SC for gcvg-git@gmane.org; Thu, 09 Mar 2006 18:14:42 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750895AbWCIROj (ORCPT ); Thu, 9 Mar 2006 12:14:39 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750847AbWCIROi (ORCPT ); Thu, 9 Mar 2006 12:14:38 -0500 Received: from lug-owl.de ([195.71.106.12]:55961 "EHLO lug-owl.de") by vger.kernel.org with ESMTP id S1750837AbWCIROi (ORCPT ); Thu, 9 Mar 2006 12:14:38 -0500 Received: by lug-owl.de (Postfix, from userid 1001) id 45A03F003D; Thu, 9 Mar 2006 18:14:34 +0100 (CET) To: Fredrik Kuivinen Content-Disposition: inline In-Reply-To: <20060309162419.GB4484@c165.ib.student.liu.se> X-Operating-System: Linux mail 2.6.12.3lug-owl X-gpg-fingerprint: 250D 3BCF 7127 0D8C A444 A961 1DBD 5E75 8399 E1BB X-gpg-key: wwwkeys.de.pgp.net X-Echelon-Enable: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-TKUeV: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll User-Agent: Mutt/1.5.9i Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: --BRE3mIcgqKzpedwo Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, 2006-03-09 17:24:19 +0100, Fredrik Kuivinen wrote: > --- /dev/null > +++ b/generate-cmdlist.sh > @@ -0,0 +1,22 @@ > +#!/bin/sh > + > +echo "/* Automatically generated by $0 */ > +struct cmdname_help=20 > +{ > + char name[16]; > + char help[64]; > +}; > + > +struct cmdname_help common_cmds[] =3D {" I'd use a here document for this. > +# Please keep this list sorted > +for i in "add" "apply" "bisect" "branch" "checkout" "cherry-pick" "clone= " \ > +"commit" "diff" "fetch" "grep" "init-db" "log" "merge" "mv" \ > +"prune" "pull" "push" "rebase" "reset" "revert" "rm" "show-branch" \ > +"status" "tag" "verify-tag" "whatchanged" You can omit all the quotes here--these words won't change by any means of variable substitution or whitespace rearrangement... > +static void list_common_cmds_help() > +{ > + int i, longest =3D 0; > + > + for(i =3D 0; i < sizeof(common_cmds)/sizeof(struct cmdname_help); i++) { This smells like a good candidate for ARRAY_SIZE()? > + if(strlen(common_cmds[i].name) > longest) > + longest =3D strlen(common_cmds[i].name); > + } Maybe make len a size_t instead of int? > + puts("The most commonly used git commands are:"); > + for(i =3D 0; i < sizeof(common_cmds)/sizeof(struct cmdname_help); i++) { ARRAY_SIZE() MfG, JBG --=20 Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481 = _ O _ "Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg = _ _ O f=C3=BCr einen Freien Staat voll Freier B=C3=BCrger" | im Internet! | i= m Irak! O O O ret =3D do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA)= ); --BRE3mIcgqKzpedwo Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFEEGJ6Hb1edYOZ4bsRAl+dAJ0f7hXpamMmqEXaz7n+7IZb+ej4zACePVlN X+oHCFYu25ZzNjhUdvU1bR0= =jVcu -----END PGP SIGNATURE----- --BRE3mIcgqKzpedwo--