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