Documentation / cmd-list.perlon commit git-svn: info --url [path] (8b014d7)
   1#!/usr/bin/perl -w
   2
   3use File::Compare qw(compare);
   4
   5sub format_one {
   6        my ($out, $nameattr) = @_;
   7        my ($name, $attr) = @$nameattr;
   8        my ($state, $description);
   9        $state = 0;
  10        open I, '<', "$name.txt" or die "No such file $name.txt";
  11        while (<I>) {
  12                if (/^NAME$/) {
  13                        $state = 1;
  14                        next;
  15                }
  16                if ($state == 1 && /^----$/) {
  17                        $state = 2;
  18                        next;
  19                }
  20                next if ($state != 2);
  21                chomp;
  22                $description = $_;
  23                last;
  24        }
  25        close I;
  26        if (!defined $description) {
  27                die "No description found in $name.txt";
  28        }
  29        if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
  30                print $out "gitlink:$name\[1\]::\n\t";
  31                if ($attr) {
  32                        print $out "($attr) ";
  33                }
  34                print $out "$text.\n\n";
  35        }
  36        else {
  37                die "Description does not match $name: $description";
  38        }
  39}
  40
  41my %cmds = ();
  42while (<DATA>) {
  43        next if /^#/;
  44
  45        chomp;
  46        my ($name, $cat, $attr) = /^(\S+)\s+(.*?)(?:\s+(.*))?$/;
  47        push @{$cmds{$cat}}, [$name, $attr];
  48}
  49
  50for my $cat (qw(ancillaryinterrogators
  51                ancillarymanipulators
  52                mainporcelain
  53                plumbinginterrogators
  54                plumbingmanipulators
  55                synchingrepositories
  56                foreignscminterface
  57                purehelpers
  58                synchelpers)) {
  59        my $out = "cmds-$cat.txt";
  60        open O, '>', "$out+" or die "Cannot open output file $out+";
  61        for (@{$cmds{$cat}}) {
  62                format_one(\*O, $_);
  63        }
  64        close O;
  65
  66        if (-f "$out" && compare("$out", "$out+") == 0) {
  67                unlink "$out+";
  68        }
  69        else {
  70                print STDERR "$out\n";
  71                rename "$out+", "$out";
  72        }
  73}
  74
  75# The following list is sorted with "sort -d" to make it easier
  76# to find entry in the resulting git.html manual page.
  77__DATA__
  78git-add                                 mainporcelain
  79git-am                                  mainporcelain
  80git-annotate                            ancillaryinterrogators
  81git-apply                               plumbingmanipulators
  82git-archimport                          foreignscminterface
  83git-archive                             mainporcelain
  84git-bisect                              mainporcelain
  85git-blame                               ancillaryinterrogators
  86git-branch                              mainporcelain
  87git-bundle                              mainporcelain
  88git-cat-file                            plumbinginterrogators
  89git-check-attr                          purehelpers
  90git-checkout                            mainporcelain
  91git-checkout-index                      plumbingmanipulators
  92git-check-ref-format                    purehelpers
  93git-cherry                              ancillaryinterrogators
  94git-cherry-pick                         mainporcelain
  95git-citool                              mainporcelain
  96git-clean                               mainporcelain
  97git-clone                               mainporcelain
  98git-commit                              mainporcelain
  99git-commit-tree                         plumbingmanipulators
 100git-config                              ancillarymanipulators
 101git-count-objects                       ancillaryinterrogators
 102git-cvsexportcommit                     foreignscminterface
 103git-cvsimport                           foreignscminterface
 104git-cvsserver                           foreignscminterface
 105git-daemon                              synchingrepositories
 106git-describe                            mainporcelain
 107git-diff                                mainporcelain
 108git-diff-files                          plumbinginterrogators
 109git-diff-index                          plumbinginterrogators
 110git-diff-tree                           plumbinginterrogators
 111git-fast-import                         ancillarymanipulators
 112git-fetch                               mainporcelain
 113git-fetch-pack                          synchingrepositories
 114git-filter-branch                       ancillarymanipulators
 115git-fmt-merge-msg                       purehelpers
 116git-for-each-ref                        plumbinginterrogators
 117git-format-patch                        mainporcelain
 118git-fsck                                ancillaryinterrogators
 119git-gc                                  mainporcelain
 120git-get-tar-commit-id                   ancillaryinterrogators
 121git-grep                                mainporcelain
 122git-gui                                 mainporcelain
 123git-hash-object                         plumbingmanipulators
 124git-http-fetch                          synchelpers
 125git-http-push                           synchelpers
 126git-imap-send                           foreignscminterface
 127git-index-pack                          plumbingmanipulators
 128git-init                                mainporcelain
 129git-instaweb                            ancillaryinterrogators
 130gitk                                    mainporcelain
 131git-log                                 mainporcelain
 132git-lost-found                          ancillarymanipulators   deprecated
 133git-ls-files                            plumbinginterrogators
 134git-ls-remote                           plumbinginterrogators
 135git-ls-tree                             plumbinginterrogators
 136git-mailinfo                            purehelpers
 137git-mailsplit                           purehelpers
 138git-merge                               mainporcelain
 139git-merge-base                          plumbinginterrogators
 140git-merge-file                          plumbingmanipulators
 141git-merge-index                         plumbingmanipulators
 142git-merge-one-file                      purehelpers
 143git-mergetool                           ancillarymanipulators
 144git-merge-tree                          ancillaryinterrogators
 145git-mktag                               plumbingmanipulators
 146git-mktree                              plumbingmanipulators
 147git-mv                                  mainporcelain
 148git-name-rev                            plumbinginterrogators
 149git-pack-objects                        plumbingmanipulators
 150git-pack-redundant                      plumbinginterrogators
 151git-pack-refs                           ancillarymanipulators
 152git-parse-remote                        synchelpers
 153git-patch-id                            purehelpers
 154git-peek-remote                         purehelpers
 155git-prune                               ancillarymanipulators
 156git-prune-packed                        plumbingmanipulators
 157git-pull                                mainporcelain
 158git-push                                mainporcelain
 159git-quiltimport                         foreignscminterface
 160git-read-tree                           plumbingmanipulators
 161git-rebase                              mainporcelain
 162git-receive-pack                        synchelpers
 163git-reflog                              ancillarymanipulators
 164git-relink                              ancillarymanipulators
 165git-remote                              ancillarymanipulators
 166git-repack                              ancillarymanipulators
 167git-request-pull                        foreignscminterface
 168git-rerere                              ancillaryinterrogators
 169git-reset                               mainporcelain
 170git-revert                              mainporcelain
 171git-rev-list                            plumbinginterrogators
 172git-rev-parse                           ancillaryinterrogators
 173git-rm                                  mainporcelain
 174git-runstatus                           ancillaryinterrogators
 175git-send-email                          foreignscminterface
 176git-send-pack                           synchingrepositories
 177git-shell                               synchelpers
 178git-shortlog                            mainporcelain
 179git-show                                mainporcelain
 180git-show-branch                         ancillaryinterrogators
 181git-show-index                          plumbinginterrogators
 182git-show-ref                            plumbinginterrogators
 183git-sh-setup                            purehelpers
 184git-stash                               mainporcelain
 185git-status                              mainporcelain
 186git-stripspace                          purehelpers
 187git-submodule                           mainporcelain
 188git-svn                                 foreignscminterface
 189git-symbolic-ref                        plumbingmanipulators
 190git-tag                                 mainporcelain
 191git-tar-tree                            plumbinginterrogators   deprecated
 192git-unpack-file                         plumbinginterrogators
 193git-unpack-objects                      plumbingmanipulators
 194git-update-index                        plumbingmanipulators
 195git-update-ref                          plumbingmanipulators
 196git-update-server-info                  synchingrepositories
 197git-upload-archive                      synchelpers
 198git-upload-pack                         synchelpers
 199git-var                                 plumbinginterrogators
 200git-verify-pack                         plumbinginterrogators
 201git-verify-tag                          ancillaryinterrogators
 202git-whatchanged                         ancillaryinterrogators
 203git-write-tree                          plumbingmanipulators