Re: [PATCH] Add help details to git help command. (This time with Perl)

2005-04-21 Thread David Greaves
We've decided to go for the individual scripts directly. :-)
Just to clarify - individual scripts or $0 name handling?
I kinda like one big script - also means we don't need to 'install' it 
to get access to Cogito.pm...

Unfortunately, you didn't send the attachments inline, so I can't
comment on them sensibly.
I'm not sure what you want here; last time you said:
Thanks. Could you please send the patches signed off and either with
content-disposition: inline or in the mail body?
So I dug around Thunderbird's config and, this time, from my email on 
the git list:
--050206040606040908050407
Content-Type: application/x-perl;
 name=gitadd.pl
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename=gitadd.pl


Perhaps my main problem is now style. I'd prefer you do format it alike
the C sources of git, with 8-chars indentation and such. Also make sure
you use spaces around (or after) operators. Also, for just few short
functions I prefer putting the functions before the code itself.
will do
David
-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add help details to git help command. (This time with Perl)

2005-04-20 Thread Petr Baudis
Dear diary, on Tue, Apr 19, 2005 at 09:04:16PM CEST, I got a letter
where David Greaves [EMAIL PROTECTED] told me that...
 I don't love the 'require gitadd.pl' but it's a gradual start...

I hate it, for one. ;-)

 Cogito.pm seems to be a good place for the library stuff.

Sounds sensible.

 git.pl
 passes everything to scripts except gitadd.pl

We've decided to go for the individual scripts directly. :-)

Unfortunately, you didn't send the attachments inline, so I can't
comment on them sensibly.

Perhaps my main problem is now style. I'd prefer you do format it alike
the C sources of git, with 8-chars indentation and such. Also make sure
you use spaces around (or after) operators. Also, for just few short
functions I prefer putting the functions before the code itself.

 use IO::File;   # leads to less perlish syntax and is standard in perl dists

Oh come on. Are you writing Perl or not? I think it looks pretty awful,
and you are using Perl filehandle idioms anyway, so...

-- 
Petr Pasky Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC] Another way to provide help details. (was Re: [PATCH] Add help details to git help command.)

2005-04-19 Thread David Greaves
Petr Baudis wrote:
Dear diary, on Tue, Apr 19, 2005 at 03:40:54AM CEST, I got a letter
where Steven Cole [EMAIL PROTECTED] told me that...
Here is perhaps a better way to provide detailed help for each
git command.  A command.help file for each command can be
written in the style of a man page.

I don't like it. I think the 'help' command should serve primarily as a
quick reference, which does not blend so well with a manual page - it's
too long and too convoluted by repeated output.
I'd just print the top comment from each file. :-)
On the other hand, having more complete docs seems like an excellent 
idea (and other threads support that)
I'd certainly like to see more specification oriented documentation...
(even if it turns out to be disposable)

Steven, if you carry on sending more verbose docs I'll certainly read 
and work with you on editing them...

Nb kernel-doc doesn't seem appropriate for user level docs.
maybe, whilst there's so much flux, have:
  git man command
that just outputs text
If Petr wants the top comment to be extracted by help then maybe a 
bottom comment block could contain the more complete text?
I *really* think that the user docs should live in the source for now 
(hence I think that git man is better than going straight to man/docbook).

I wasn't sure whether to perlise the code or do a shell-lib - but 
looking at the algorithms needed in things like git status I reckon the 
shell will end up becoming a hackish mess of awk/sed/tr/sort/uniq/pipe 
(ie perl) anyway.

So I'm going to have a go at that - Petr, if you have a minute could you 
send me, off list, a bit of perl code that epitomises the style you like?

David
-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add help details to git help command. (This time with Perl)

2005-04-19 Thread Petr Baudis
Dear diary, on Tue, Apr 19, 2005 at 07:35:15PM CEST, I got a letter
where Steven Cole [EMAIL PROTECTED] told me that...
 Example:
..snip a perfect-looking example..
 -
 Speaking of 'git diff', I ran that before applying the following patch,
 and got a diff starting thusly:
 
  --- /dev/null
  +++ b/gitmerge-file.sh
 
 I had earlier done a 'git pull pasky', which was 'Up to date'.

Check/prune your add/rm-queue.

 So, the following patch is a conventional diff.
 
 If the Perl filename or code  is too hideous, you're more than
 welcome to change it.

I'd actually prefer to just throw the whole help command handling
to githelp.pl. I dislike helper scripts if I can avoid them. ;-)

-- 
Petr Pasky Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add help details to git help command. (This time with Perl)

2005-04-19 Thread David Greaves
Steven Cole wrote:
Speaking of I think, the name cogito was suggested for the
SCM layer, but IIRC Linus suggested staying with just plain git. Petr
suggested tig, perhaps because it looks at git from another point of view.
I haven't read _all_ the mails - I thought cogito was kinda selected and 
 I got the feeling that Linus wasn't exactly bothered what it was called.
Anyway, git has a rename that needs testing at some point...

legitSince git is GPLv2, but perhaps a little too French.
That made me smile.
Quite a few entendres in there...
It's Petr's baby - he gets to name it.
David
-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add help details to git help command.

2005-04-18 Thread Steven Cole
Petr Baudis wrote:
Dear diary, on Mon, Apr 18, 2005 at 06:42:26AM CEST, I got a letter
where Steven Cole [EMAIL PROTECTED] told me that...
[snippage]

This patch will provide the comment lines in the shell script associated
with the command, cleaned up a bit for presentation.
BUGS: This will also print any comments in the entire file, which may
not be desired.  If a command name and shell script filename
do not follow the usual convention, this won't work, e.g. ci for commit.

Hey, those BUGS are the only slightly non-trivial thing on the whole
thing! I could do this patch myself... ;-) Also, you don't want to print
the first newline and the Copyright notices.
Fixed extra vertical whitespace, Copyright notice problems, and issue
with git help ci.
Here's a better version.  Didn't fix the more interesting bugs, as I'm
pressed for time (aren't we all).  Perhaps someone can polish this up.
Anyway, I think it's pretty useful in its present form.
Thanks,
Steven
-
This patch will provide the comment lines in the shell script associated
with the command, cleaned up a bit for presentation.
BUGS: This will also print any comments in the entire file, which may
not be desired.  If a command name and shell script filename
do not follow the usual convention, this won't work.
git: b648169640025bd68d1b27a0fcc85b65d85e4440
--- git
+++ git 2005-04-18 10:34:17.0 -0600
@@ -19,6 +19,11 @@
 help () {
+
+command=$1
+scriptfile=git$command.sh
+
+if [ ! $command ]; then
cat __END__
 The GIT scripted toolkit  $(gitversion.sh)
@@ -48,7 +53,10 @@
track   [RNAME]
version
+Additional help is available with: git help COMMAND
+
 Note that these expressions can be used interchangably as IDs:
+
empty string (current HEAD)
local (the local branch if tracking a remote one)
remote name (as registered with git addremote)
@@ -57,6 +65,14 @@
commit object hash (as returned by commit-id)
tree object hash (accepted only by some commands)
 __END__
+fi
+if [ $scriptfile = gitci.sh ]; then
+   scriptfile=gitcommit.sh
+fi
+if [ ! $scriptfile = git.sh ]; then
+   grep ^# $scriptfile | grep -v !/bin | grep -v (c) \
+   | cut -c 2- | grep ^.
+fi
 }

-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html