git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: Fredrik Kuivinen <freku045@student.liu.se>
Cc: git@vger.kernel.org, junkio@cox.net
Subject: Re: [PATCH 1/3] Nicer output from 'git'
Date: Thu, 9 Mar 2006 18:14:34 +0100	[thread overview]
Message-ID: <20060309171434.GD4297@lug-owl.de> (raw)
In-Reply-To: <20060309162419.GB4484@c165.ib.student.liu.se>

[-- Attachment #1: Type: text/plain, Size: 1668 bytes --]

On Thu, 2006-03-09 17:24:19 +0100, Fredrik Kuivinen <freku045@student.liu.se> wrote:
> --- /dev/null
> +++ b/generate-cmdlist.sh
> @@ -0,0 +1,22 @@
> +#!/bin/sh
> +
> +echo "/* Automatically generated by $0 */
> +struct cmdname_help 
> +{
> +    char name[16];
> +    char help[64];
> +};
> +
> +struct cmdname_help common_cmds[] = {"

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 = 0;
> +
> +	for(i = 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 = strlen(common_cmds[i].name);
> +	}

Maybe make len a size_t instead of int?

> +	puts("The most commonly used git commands are:");
> +	for(i = 0; i < sizeof(common_cmds)/sizeof(struct cmdname_help); i++) {

ARRAY_SIZE()

MfG, JBG

-- 
Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 für einen Freien Staat voll Freier Bürger"  | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2006-03-09 17:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-09 16:17 [PATCH 0/3] Make the output of 'git' nicer Fredrik Kuivinen
2006-03-09 16:24 ` [PATCH 1/3] Nicer output from 'git' Fredrik Kuivinen
2006-03-09 17:14   ` Jan-Benedict Glaw [this message]
2006-03-09 16:24 ` [PATCH 2/3] Fix some inconsistencies in the docs Fredrik Kuivinen
2006-03-09 16:24 ` [PATCH 3/3] Remove trailing dot after short description Fredrik Kuivinen
2006-03-09 17:32 ` [PATCH 0/3] Make the output of 'git' nicer Ryan Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060309171434.GD4297@lug-owl.de \
    --to=jbglaw@lug-owl.de \
    --cc=freku045@student.liu.se \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).