Re: [PATCH] Add help details to git help command. (This time with Perl)
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)
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: [PATCH] Add help details to git help command. (This time with Perl)
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. (This time with Perl)
David Greaves wrote: Petr Baudis wrote: Dear diary, on Tue, Apr 19, 2005 at 07:35:15PM CEST, I got a letter where Steven Cole <[EMAIL PROTECTED]> told me that... I've been working on git.pl and getting help working nicely things to try: git.pl help git.pl add git.pl add --help git.pl add --man git.pl help add The main objectives: * get a reasonable perl code base in git.pl * provide some way to document WTF is going on :) * keep the docs near the developer * allow variations in verbosity * modularise * don't use modules outside the base perl set * allow a gentle migration (so start by calling the .sh's) I don't like the pod2usage calling convention but I use them for now. I don't love the 'require gitadd.pl' but it's a gradual start... Cogito.pm seems to be a good place for the library stuff. git.pl passes everything to scripts except gitadd.pl works when called from somewhere other than the git dir I don't feel 100% about the fixup ports gitadd.pl I thought I'd ask for comments before I spent too much time on this... David I only did my version which spits out the comments at the top of the shell script as a quick hack. This looks good to me. Keeping the docs near the developer is essential, I think. 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. If we ever do decide to name the SCM layer (the git-pasky stuff) something with "git inside", other choices are: agitato Beethoven's "Moonlight Sonata" 3rd movment is "Presto agitato" legit Since git is GPLv2, but perhaps a little too French. regurgitate No comment neccessary. Steven - 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)
Petr Baudis wrote: Dear diary, on Tue, Apr 19, 2005 at 07:35:15PM CEST, I got a letter where Steven Cole <[EMAIL PROTECTED]> told me that... I've been working on git.pl and getting help working nicely things to try: git.pl help git.pl add git.pl add --help git.pl add --man git.pl help add The main objectives: * get a reasonable perl code base in git.pl * provide some way to document WTF is going on :) * keep the docs near the developer * allow variations in verbosity * modularise * don't use modules outside the base perl set * allow a gentle migration (so start by calling the .sh's) I don't like the pod2usage calling convention but I use them for now. I don't love the 'require gitadd.pl' but it's a gradual start... Cogito.pm seems to be a good place for the library stuff. git.pl passes everything to scripts except gitadd.pl works when called from somewhere other than the git dir I don't feel 100% about the fixup ports gitadd.pl I thought I'd ask for comments before I spent too much time on this... David -- Cogito.pm Description: Perl program gitadd.pl Description: Perl program git.pl Description: Perl program
Re: [PATCH] Add help details to git help command. (This time with Perl)
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)
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. OK, here is a patch which _may_ do what you want. This one no longer prints comments embedded later in the file, and doesn't print the first newline and disposes of the (c) notices as requested. And does the right thing for git help ci. Example: [EMAIL PROTECTED] git-pasky-testing]$ ./git help diff Make a diff between two GIT trees. By default compares the current working tree to the state at the last commit. You can specify -r rev1:rev2 or -r rev1 -r rev2 to tell it to make a diff between the specified revisions. If you do not specify a revision, the current working tree is implied (note that no revision is different from empty revision - -r rev: compares between rev and HEAD, while -r rev compares between rev and working tree). -p instead of one ID denotes a parent commit to the specified ID (which must not be a tree, obviously). Outputs a diff converting the first tree to the second one. - 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'. 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. Steven - This patch will provide the comment lines in the shell script associated with the command, cleaned up a bit for presentation. Thanks to Bob Newell for some Perl help. Signed-off-by: Steven Cole <[EMAIL PROTECTED]> diff -urN git-pasky-orig/git git-pasky-testing/git --- git-pasky-orig/git 2005-04-19 10:27:54.0 -0600 +++ git-pasky-testing/git 2005-04-19 10:19:08.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,6 +53,8 @@ track [RNAME] version +Additional help is available with: git help COMMAND + Note that these expressions can be used interchangably as "ID"s: empty string (current HEAD) remote name (as registered with git addremote) @@ -56,6 +63,13 @@ 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 + print_help_header.pl <$scriptfile | grep -v "(c)" | cut -c 3- +fi } diff -urN git-pasky-orig/Makefile git-pasky-testing/Makefile --- git-pasky-orig/Makefile 2005-04-19 10:27:54.0 -0600 +++ git-pasky-testing/Makefile 2005-04-19 10:32:50.0 -0600 @@ -21,7 +21,7 @@ gitcommit.sh gitdiff-do gitdiff.sh gitlog.sh gitls.sh gitlsobj.sh \ gitmerge.sh gitpull.sh gitrm.sh gittag.sh gittrack.sh gitexport.sh \ gitapply.sh gitcancel.sh gitXlntree.sh commit-id gitlsremote.sh \ - gitfork.sh gitinit.sh gitseek.sh gitstatus.sh + gitfork.sh gitinit.sh gitseek.sh gitstatus.sh print_help_header.pl COMMON=read-cache.o diff -urN git-pasky-orig/print_help_header.pl git-pasky-testing/print_help_header.pl --- git-pasky-orig/print_help_header.pl 1969-12-31 17:00:00.0 -0700 +++ git-pasky-testing/print_help_header.pl 2005-04-19 10:24:34.0 -0600 @@ -0,0 +1,10 @@ +#!/usr/bin/perl +# +# Prints the block of text preceded by # +# Copyright (c) Steven Cole, 2005 +# +# reads from stdin writes to stdout no error checking +;; +while (substr( $line=, 0, 1) eq "#") { + print $line; +} - 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