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