Documentation / cmd-list.perlon commit git-svn: documentation updates (a81ed0b)
   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-remote                              ancillarymanipulators
 149git-request-pull                        foreignscminterface
 150git-rerere                              ancillaryinterrogators
 151git-reset                               mainporcelain
 152git-revert                              mainporcelain
 153git-rev-list                            plumbinginterrogators
 154git-rev-parse                           ancillaryinterrogators
 155git-rm                                  mainporcelain
 156git-runstatus                           ancillaryinterrogators
 157git-send-email                          foreignscminterface
 158git-send-pack                           synchingrepositories
 159git-shell                               synchelpers
 160git-shortlog                            mainporcelain
 161git-show                                mainporcelain
 162git-show-branch                         ancillaryinterrogators
 163git-show-index                          plumbinginterrogators
 164git-show-ref                            plumbinginterrogators
 165git-sh-setup                            purehelpers
 166git-ssh-fetch                           synchingrepositories
 167git-ssh-upload                          synchingrepositories
 168git-status                              mainporcelain
 169git-stripspace                          purehelpers
 170git-svn                                 foreignscminterface
 171git-svnimport                           foreignscminterface
 172git-symbolic-ref                        plumbingmanipulators
 173git-tag                                 mainporcelain
 174git-tar-tree                            plumbinginterrogators
 175git-unpack-file                         plumbinginterrogators
 176git-unpack-objects                      plumbingmanipulators
 177git-update-index                        plumbingmanipulators
 178git-update-ref                          plumbingmanipulators
 179git-update-server-info                  synchingrepositories
 180git-upload-archive                      synchelpers
 181git-upload-pack                         synchelpers
 182git-var                                 plumbinginterrogators
 183git-verify-pack                         plumbinginterrogators
 184git-verify-tag                          ancillaryinterrogators
 185git-whatchanged                         ancillaryinterrogators
 186git-write-tree                          plumbingmanipulators