Documentation / cmd-list.perlon commit git-bundle: only die if pack would be empty, warn if ref is skipped (34572ed)
   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-bundle                              mainporcelain
  74git-cat-file                            plumbinginterrogators
  75git-checkout-index                      plumbingmanipulators
  76git-checkout                            mainporcelain
  77git-check-ref-format                    purehelpers
  78git-cherry                              ancillaryinterrogators
  79git-cherry-pick                         mainporcelain
  80git-clean                               mainporcelain
  81git-clone                               mainporcelain
  82git-commit                              mainporcelain
  83git-commit-tree                         plumbingmanipulators
  84git-convert-objects                     ancillarymanipulators
  85git-count-objects                       ancillaryinterrogators
  86git-cvsexportcommit                     foreignscminterface
  87git-cvsimport                           foreignscminterface
  88git-cvsserver                           foreignscminterface
  89git-daemon                              synchingrepositories
  90git-describe                            mainporcelain
  91git-diff-files                          plumbinginterrogators
  92git-diff-index                          plumbinginterrogators
  93git-diff                                mainporcelain
  94git-diff-tree                           plumbinginterrogators
  95git-fast-import                         ancillarymanipulators
  96git-fetch                               mainporcelain
  97git-fetch-pack                          synchingrepositories
  98git-fmt-merge-msg                       purehelpers
  99git-for-each-ref                        plumbinginterrogators
 100git-format-patch                        mainporcelain
 101git-fsck                                ancillaryinterrogators
 102git-gc                                  mainporcelain
 103git-get-tar-commit-id                   ancillaryinterrogators
 104git-grep                                mainporcelain
 105git-hash-object                         plumbingmanipulators
 106git-http-fetch                          synchelpers
 107git-http-push                           synchelpers
 108git-imap-send                           foreignscminterface
 109git-index-pack                          plumbingmanipulators
 110git-init                                mainporcelain
 111git-instaweb                            ancillaryinterrogators
 112gitk                                    mainporcelain
 113git-local-fetch                         synchingrepositories
 114git-log                                 mainporcelain
 115git-lost-found                          ancillarymanipulators
 116git-ls-files                            plumbinginterrogators
 117git-ls-remote                           plumbinginterrogators
 118git-ls-tree                             plumbinginterrogators
 119git-mailinfo                            purehelpers
 120git-mailsplit                           purehelpers
 121git-merge-base                          plumbinginterrogators
 122git-merge-file                          plumbingmanipulators
 123git-merge-index                         plumbingmanipulators
 124git-merge                               mainporcelain
 125git-merge-one-file                      purehelpers
 126git-merge-tree                          ancillaryinterrogators
 127git-mktag                               plumbingmanipulators
 128git-mktree                              plumbingmanipulators
 129git-mv                                  mainporcelain
 130git-name-rev                            plumbinginterrogators
 131git-pack-objects                        plumbingmanipulators
 132git-pack-redundant                      plumbinginterrogators
 133git-pack-refs                           ancillarymanipulators
 134git-parse-remote                        synchelpers
 135git-patch-id                            purehelpers
 136git-peek-remote                         purehelpers
 137git-prune                               ancillarymanipulators
 138git-prune-packed                        plumbingmanipulators
 139git-pull                                mainporcelain
 140git-push                                mainporcelain
 141git-quiltimport                         foreignscminterface
 142git-read-tree                           plumbingmanipulators
 143git-rebase                              mainporcelain
 144git-receive-pack                        synchelpers
 145git-reflog                              ancillarymanipulators
 146git-relink                              ancillarymanipulators
 147git-repack                              ancillarymanipulators
 148git-config                              ancillarymanipulators
 149git-remote                              ancillarymanipulators
 150git-request-pull                        foreignscminterface
 151git-rerere                              ancillaryinterrogators
 152git-reset                               mainporcelain
 153git-revert                              mainporcelain
 154git-rev-list                            plumbinginterrogators
 155git-rev-parse                           ancillaryinterrogators
 156git-rm                                  mainporcelain
 157git-runstatus                           ancillaryinterrogators
 158git-send-email                          foreignscminterface
 159git-send-pack                           synchingrepositories
 160git-shell                               synchelpers
 161git-shortlog                            mainporcelain
 162git-show                                mainporcelain
 163git-show-branch                         ancillaryinterrogators
 164git-show-index                          plumbinginterrogators
 165git-show-ref                            plumbinginterrogators
 166git-sh-setup                            purehelpers
 167git-ssh-fetch                           synchingrepositories
 168git-ssh-upload                          synchingrepositories
 169git-status                              mainporcelain
 170git-stripspace                          purehelpers
 171git-svn                                 foreignscminterface
 172git-svnimport                           foreignscminterface
 173git-symbolic-ref                        plumbingmanipulators
 174git-tag                                 mainporcelain
 175git-tar-tree                            plumbinginterrogators
 176git-unpack-file                         plumbinginterrogators
 177git-unpack-objects                      plumbingmanipulators
 178git-update-index                        plumbingmanipulators
 179git-update-ref                          plumbingmanipulators
 180git-update-server-info                  synchingrepositories
 181git-upload-archive                      synchelpers
 182git-upload-pack                         synchelpers
 183git-var                                 plumbinginterrogators
 184git-verify-pack                         plumbinginterrogators
 185git-verify-tag                          ancillaryinterrogators
 186git-whatchanged                         ancillaryinterrogators
 187git-write-tree                          plumbingmanipulators