Documentation / cmd-list.perlon commit Merge branch 'maint' (4342572)
   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-attr                          purehelpers
  88git-check-ref-format                    purehelpers
  89git-cherry                              ancillaryinterrogators
  90git-cherry-pick                         mainporcelain
  91git-clean                               mainporcelain
  92git-clone                               mainporcelain
  93git-commit                              mainporcelain
  94git-commit-tree                         plumbingmanipulators
  95git-convert-objects                     ancillarymanipulators
  96git-count-objects                       ancillaryinterrogators
  97git-cvsexportcommit                     foreignscminterface
  98git-cvsimport                           foreignscminterface
  99git-cvsserver                           foreignscminterface
 100git-daemon                              synchingrepositories
 101git-describe                            mainporcelain
 102git-diff-files                          plumbinginterrogators
 103git-diff-index                          plumbinginterrogators
 104git-diff                                mainporcelain
 105git-diff-tree                           plumbinginterrogators
 106git-fast-import                         ancillarymanipulators
 107git-fetch                               mainporcelain
 108git-fetch-pack                          synchingrepositories
 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-hash-object                         plumbingmanipulators
 117git-http-fetch                          synchelpers
 118git-http-push                           synchelpers
 119git-imap-send                           foreignscminterface
 120git-index-pack                          plumbingmanipulators
 121git-init                                mainporcelain
 122git-instaweb                            ancillaryinterrogators
 123gitk                                    mainporcelain
 124git-local-fetch                         synchingrepositories
 125git-log                                 mainporcelain
 126git-lost-found                          ancillarymanipulators
 127git-ls-files                            plumbinginterrogators
 128git-ls-remote                           plumbinginterrogators
 129git-ls-tree                             plumbinginterrogators
 130git-mailinfo                            purehelpers
 131git-mailsplit                           purehelpers
 132git-merge-base                          plumbinginterrogators
 133git-merge-file                          plumbingmanipulators
 134git-merge-index                         plumbingmanipulators
 135git-merge                               mainporcelain
 136git-merge-one-file                      purehelpers
 137git-merge-tree                          ancillaryinterrogators
 138git-mergetool                           ancillarymanipulators
 139git-mktag                               plumbingmanipulators
 140git-mktree                              plumbingmanipulators
 141git-mv                                  mainporcelain
 142git-name-rev                            plumbinginterrogators
 143git-pack-objects                        plumbingmanipulators
 144git-pack-redundant                      plumbinginterrogators
 145git-pack-refs                           ancillarymanipulators
 146git-parse-remote                        synchelpers
 147git-patch-id                            purehelpers
 148git-peek-remote                         purehelpers
 149git-prune                               ancillarymanipulators
 150git-prune-packed                        plumbingmanipulators
 151git-pull                                mainporcelain
 152git-push                                mainporcelain
 153git-quiltimport                         foreignscminterface
 154git-read-tree                           plumbingmanipulators
 155git-rebase                              mainporcelain
 156git-receive-pack                        synchelpers
 157git-reflog                              ancillarymanipulators
 158git-relink                              ancillarymanipulators
 159git-repack                              ancillarymanipulators
 160git-config                              ancillarymanipulators
 161git-remote                              ancillarymanipulators
 162git-request-pull                        foreignscminterface
 163git-rerere                              ancillaryinterrogators
 164git-reset                               mainporcelain
 165git-revert                              mainporcelain
 166git-rev-list                            plumbinginterrogators
 167git-rev-parse                           ancillaryinterrogators
 168git-rm                                  mainporcelain
 169git-runstatus                           ancillaryinterrogators
 170git-send-email                          foreignscminterface
 171git-send-pack                           synchingrepositories
 172git-shell                               synchelpers
 173git-shortlog                            mainporcelain
 174git-show                                mainporcelain
 175git-show-branch                         ancillaryinterrogators
 176git-show-index                          plumbinginterrogators
 177git-show-ref                            plumbinginterrogators
 178git-sh-setup                            purehelpers
 179git-ssh-fetch                           synchingrepositories
 180git-ssh-upload                          synchingrepositories
 181git-status                              mainporcelain
 182git-stripspace                          purehelpers
 183git-svn                                 foreignscminterface
 184git-svnimport                           foreignscminterface
 185git-symbolic-ref                        plumbingmanipulators
 186git-tag                                 mainporcelain
 187git-tar-tree                            plumbinginterrogators
 188git-unpack-file                         plumbinginterrogators
 189git-unpack-objects                      plumbingmanipulators
 190git-update-index                        plumbingmanipulators
 191git-update-ref                          plumbingmanipulators
 192git-update-server-info                  synchingrepositories
 193git-upload-archive                      synchelpers
 194git-upload-pack                         synchelpers
 195git-var                                 plumbinginterrogators
 196git-verify-pack                         plumbinginterrogators
 197git-verify-tag                          ancillaryinterrogators
 198git-whatchanged                         ancillaryinterrogators
 199git-write-tree                          plumbingmanipulators