Documentation / cmd-list.perlon commit Merge branch 'maint' (c43f64a)
   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-clean                               mainporcelain
  90git-clone                               mainporcelain
  91git-commit                              mainporcelain
  92git-commit-tree                         plumbingmanipulators
  93git-convert-objects                     ancillarymanipulators
  94git-count-objects                       ancillaryinterrogators
  95git-cvsexportcommit                     foreignscminterface
  96git-cvsimport                           foreignscminterface
  97git-cvsserver                           foreignscminterface
  98git-daemon                              synchingrepositories
  99git-describe                            mainporcelain
 100git-diff-files                          plumbinginterrogators
 101git-diff-index                          plumbinginterrogators
 102git-diff                                mainporcelain
 103git-diff-tree                           plumbinginterrogators
 104git-fast-import                         ancillarymanipulators
 105git-fetch                               mainporcelain
 106git-fetch-pack                          synchingrepositories
 107git-fmt-merge-msg                       purehelpers
 108git-for-each-ref                        plumbinginterrogators
 109git-format-patch                        mainporcelain
 110git-fsck                                ancillaryinterrogators
 111git-gc                                  mainporcelain
 112git-get-tar-commit-id                   ancillaryinterrogators
 113git-grep                                mainporcelain
 114git-hash-object                         plumbingmanipulators
 115git-http-fetch                          synchelpers
 116git-http-push                           synchelpers
 117git-imap-send                           foreignscminterface
 118git-index-pack                          plumbingmanipulators
 119git-init                                mainporcelain
 120git-instaweb                            ancillaryinterrogators
 121gitk                                    mainporcelain
 122git-local-fetch                         synchingrepositories
 123git-log                                 mainporcelain
 124git-lost-found                          ancillarymanipulators
 125git-ls-files                            plumbinginterrogators
 126git-ls-remote                           plumbinginterrogators
 127git-ls-tree                             plumbinginterrogators
 128git-mailinfo                            purehelpers
 129git-mailsplit                           purehelpers
 130git-merge-base                          plumbinginterrogators
 131git-merge-file                          plumbingmanipulators
 132git-merge-index                         plumbingmanipulators
 133git-merge                               mainporcelain
 134git-merge-one-file                      purehelpers
 135git-merge-tree                          ancillaryinterrogators
 136git-mergetool                           ancillarymanipulators
 137git-mktag                               plumbingmanipulators
 138git-mktree                              plumbingmanipulators
 139git-mv                                  mainporcelain
 140git-name-rev                            plumbinginterrogators
 141git-pack-objects                        plumbingmanipulators
 142git-pack-redundant                      plumbinginterrogators
 143git-pack-refs                           ancillarymanipulators
 144git-parse-remote                        synchelpers
 145git-patch-id                            purehelpers
 146git-peek-remote                         purehelpers
 147git-prune                               ancillarymanipulators
 148git-prune-packed                        plumbingmanipulators
 149git-pull                                mainporcelain
 150git-push                                mainporcelain
 151git-quiltimport                         foreignscminterface
 152git-read-tree                           plumbingmanipulators
 153git-rebase                              mainporcelain
 154git-receive-pack                        synchelpers
 155git-reflog                              ancillarymanipulators
 156git-relink                              ancillarymanipulators
 157git-repack                              ancillarymanipulators
 158git-config                              ancillarymanipulators
 159git-remote                              ancillarymanipulators
 160git-request-pull                        foreignscminterface
 161git-rerere                              ancillaryinterrogators
 162git-reset                               mainporcelain
 163git-revert                              mainporcelain
 164git-rev-list                            plumbinginterrogators
 165git-rev-parse                           ancillaryinterrogators
 166git-rm                                  mainporcelain
 167git-runstatus                           ancillaryinterrogators
 168git-send-email                          foreignscminterface
 169git-send-pack                           synchingrepositories
 170git-shell                               synchelpers
 171git-shortlog                            mainporcelain
 172git-show                                mainporcelain
 173git-show-branch                         ancillaryinterrogators
 174git-show-index                          plumbinginterrogators
 175git-show-ref                            plumbinginterrogators
 176git-sh-setup                            purehelpers
 177git-ssh-fetch                           synchingrepositories
 178git-ssh-upload                          synchingrepositories
 179git-status                              mainporcelain
 180git-stripspace                          purehelpers
 181git-submodule                           mainporcelain
 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