Documentation / cmd-list.perlon commit Merge branch 'maint' (0707a9d)
   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-apply                               plumbingmanipulators
  76git-archimport                          foreignscminterface
  77git-archive                             mainporcelain
  78git-bisect                              mainporcelain
  79git-blame                               ancillaryinterrogators
  80git-branch                              mainporcelain
  81git-bundle                              mainporcelain
  82git-cat-file                            plumbinginterrogators
  83git-checkout-index                      plumbingmanipulators
  84git-checkout                            mainporcelain
  85git-check-attr                          purehelpers
  86git-check-ref-format                    purehelpers
  87git-cherry                              ancillaryinterrogators
  88git-cherry-pick                         mainporcelain
  89git-citool                              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-filter-branch                       ancillarymanipulators
 109git-fmt-merge-msg                       purehelpers
 110git-for-each-ref                        plumbinginterrogators
 111git-format-patch                        mainporcelain
 112git-fsck                                ancillaryinterrogators
 113git-gc                                  mainporcelain
 114git-get-tar-commit-id                   ancillaryinterrogators
 115git-grep                                mainporcelain
 116git-gui                                 mainporcelain
 117git-hash-object                         plumbingmanipulators
 118git-http-fetch                          synchelpers
 119git-http-push                           synchelpers
 120git-imap-send                           foreignscminterface
 121git-index-pack                          plumbingmanipulators
 122git-init                                mainporcelain
 123git-instaweb                            ancillaryinterrogators
 124gitk                                    mainporcelain
 125git-local-fetch                         synchingrepositories
 126git-log                                 mainporcelain
 127git-lost-found                          ancillarymanipulators
 128git-ls-files                            plumbinginterrogators
 129git-ls-remote                           plumbinginterrogators
 130git-ls-tree                             plumbinginterrogators
 131git-mailinfo                            purehelpers
 132git-mailsplit                           purehelpers
 133git-merge-base                          plumbinginterrogators
 134git-merge-file                          plumbingmanipulators
 135git-merge-index                         plumbingmanipulators
 136git-merge                               mainporcelain
 137git-merge-one-file                      purehelpers
 138git-merge-tree                          ancillaryinterrogators
 139git-mergetool                           ancillarymanipulators
 140git-mktag                               plumbingmanipulators
 141git-mktree                              plumbingmanipulators
 142git-mv                                  mainporcelain
 143git-name-rev                            plumbinginterrogators
 144git-pack-objects                        plumbingmanipulators
 145git-pack-redundant                      plumbinginterrogators
 146git-pack-refs                           ancillarymanipulators
 147git-parse-remote                        synchelpers
 148git-patch-id                            purehelpers
 149git-peek-remote                         purehelpers
 150git-prune                               ancillarymanipulators
 151git-prune-packed                        plumbingmanipulators
 152git-pull                                mainporcelain
 153git-push                                mainporcelain
 154git-quiltimport                         foreignscminterface
 155git-read-tree                           plumbingmanipulators
 156git-rebase                              mainporcelain
 157git-receive-pack                        synchelpers
 158git-reflog                              ancillarymanipulators
 159git-relink                              ancillarymanipulators
 160git-repack                              ancillarymanipulators
 161git-config                              ancillarymanipulators
 162git-remote                              ancillarymanipulators
 163git-request-pull                        foreignscminterface
 164git-rerere                              ancillaryinterrogators
 165git-reset                               mainporcelain
 166git-revert                              mainporcelain
 167git-rev-list                            plumbinginterrogators
 168git-rev-parse                           ancillaryinterrogators
 169git-rm                                  mainporcelain
 170git-runstatus                           ancillaryinterrogators
 171git-send-email                          foreignscminterface
 172git-send-pack                           synchingrepositories
 173git-shell                               synchelpers
 174git-shortlog                            mainporcelain
 175git-show                                mainporcelain
 176git-show-branch                         ancillaryinterrogators
 177git-show-index                          plumbinginterrogators
 178git-show-ref                            plumbinginterrogators
 179git-sh-setup                            purehelpers
 180git-ssh-fetch                           synchingrepositories
 181git-ssh-upload                          synchingrepositories
 182git-stash                               mainporcelain
 183git-status                              mainporcelain
 184git-stripspace                          purehelpers
 185git-submodule                           mainporcelain
 186git-svn                                 foreignscminterface
 187git-svnimport                           foreignscminterface
 188git-symbolic-ref                        plumbingmanipulators
 189git-tag                                 mainporcelain
 190git-tar-tree                            plumbinginterrogators
 191git-unpack-file                         plumbinginterrogators
 192git-unpack-objects                      plumbingmanipulators
 193git-update-index                        plumbingmanipulators
 194git-update-ref                          plumbingmanipulators
 195git-update-server-info                  synchingrepositories
 196git-upload-archive                      synchelpers
 197git-upload-pack                         synchelpers
 198git-var                                 plumbinginterrogators
 199git-verify-pack                         plumbinginterrogators
 200git-verify-tag                          ancillaryinterrogators
 201git-whatchanged                         ancillaryinterrogators
 202git-write-tree                          plumbingmanipulators