Documentation / cmd-list.perlon commit Say when --track is useful in the git-checkout docs. (ac15074)
   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# The following list is sorted with "sort -d" to make it easier
  72# to find entry in the resulting git.html manual page.
  73__DATA__
  74git-add                                 mainporcelain
  75git-am                                  mainporcelain
  76git-annotate                            ancillaryinterrogators
  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-check-attr                          purehelpers
  86git-checkout                            mainporcelain
  87git-checkout-index                      plumbingmanipulators
  88git-check-ref-format                    purehelpers
  89git-cherry                              ancillaryinterrogators
  90git-cherry-pick                         mainporcelain
  91git-citool                              mainporcelain
  92git-clean                               mainporcelain
  93git-clone                               mainporcelain
  94git-commit                              mainporcelain
  95git-commit-tree                         plumbingmanipulators
  96git-config                              ancillarymanipulators
  97git-convert-objects                     ancillarymanipulators
  98git-count-objects                       ancillaryinterrogators
  99git-cvsexportcommit                     foreignscminterface
 100git-cvsimport                           foreignscminterface
 101git-cvsserver                           foreignscminterface
 102git-daemon                              synchingrepositories
 103git-describe                            mainporcelain
 104git-diff                                mainporcelain
 105git-diff-files                          plumbinginterrogators
 106git-diff-index                          plumbinginterrogators
 107git-diff-tree                           plumbinginterrogators
 108git-fast-import                         ancillarymanipulators
 109git-fetch                               mainporcelain
 110git-fetch-pack                          synchingrepositories
 111git-filter-branch                       ancillarymanipulators
 112git-fmt-merge-msg                       purehelpers
 113git-for-each-ref                        plumbinginterrogators
 114git-format-patch                        mainporcelain
 115git-fsck                                ancillaryinterrogators
 116git-gc                                  mainporcelain
 117git-get-tar-commit-id                   ancillaryinterrogators
 118git-grep                                mainporcelain
 119git-gui                                 mainporcelain
 120git-hash-object                         plumbingmanipulators
 121git-http-fetch                          synchelpers
 122git-http-push                           synchelpers
 123git-imap-send                           foreignscminterface
 124git-index-pack                          plumbingmanipulators
 125git-init                                mainporcelain
 126git-instaweb                            ancillaryinterrogators
 127gitk                                    mainporcelain
 128git-local-fetch                         synchingrepositories
 129git-log                                 mainporcelain
 130git-lost-found                          ancillarymanipulators
 131git-ls-files                            plumbinginterrogators
 132git-ls-remote                           plumbinginterrogators
 133git-ls-tree                             plumbinginterrogators
 134git-mailinfo                            purehelpers
 135git-mailsplit                           purehelpers
 136git-merge                               mainporcelain
 137git-merge-base                          plumbinginterrogators
 138git-merge-file                          plumbingmanipulators
 139git-merge-index                         plumbingmanipulators
 140git-merge-one-file                      purehelpers
 141git-mergetool                           ancillarymanipulators
 142git-merge-tree                          ancillaryinterrogators
 143git-mktag                               plumbingmanipulators
 144git-mktree                              plumbingmanipulators
 145git-mv                                  mainporcelain
 146git-name-rev                            plumbinginterrogators
 147git-pack-objects                        plumbingmanipulators
 148git-pack-redundant                      plumbinginterrogators
 149git-pack-refs                           ancillarymanipulators
 150git-parse-remote                        synchelpers
 151git-patch-id                            purehelpers
 152git-peek-remote                         purehelpers
 153git-prune                               ancillarymanipulators
 154git-prune-packed                        plumbingmanipulators
 155git-pull                                mainporcelain
 156git-push                                mainporcelain
 157git-quiltimport                         foreignscminterface
 158git-read-tree                           plumbingmanipulators
 159git-rebase                              mainporcelain
 160git-receive-pack                        synchelpers
 161git-reflog                              ancillarymanipulators
 162git-relink                              ancillarymanipulators
 163git-remote                              ancillarymanipulators
 164git-repack                              ancillarymanipulators
 165git-request-pull                        foreignscminterface
 166git-rerere                              ancillaryinterrogators
 167git-reset                               mainporcelain
 168git-revert                              mainporcelain
 169git-rev-list                            plumbinginterrogators
 170git-rev-parse                           ancillaryinterrogators
 171git-rm                                  mainporcelain
 172git-runstatus                           ancillaryinterrogators
 173git-send-email                          foreignscminterface
 174git-send-pack                           synchingrepositories
 175git-shell                               synchelpers
 176git-shortlog                            mainporcelain
 177git-show                                mainporcelain
 178git-show-branch                         ancillaryinterrogators
 179git-show-index                          plumbinginterrogators
 180git-show-ref                            plumbinginterrogators
 181git-sh-setup                            purehelpers
 182git-ssh-fetch                           synchingrepositories
 183git-ssh-upload                          synchingrepositories
 184git-stash                               mainporcelain
 185git-status                              mainporcelain
 186git-stripspace                          purehelpers
 187git-submodule                           mainporcelain
 188git-svn                                 foreignscminterface
 189git-svnimport                           foreignscminterface
 190git-symbolic-ref                        plumbingmanipulators
 191git-tag                                 mainporcelain
 192git-tar-tree                            plumbinginterrogators
 193git-unpack-file                         plumbinginterrogators
 194git-unpack-objects                      plumbingmanipulators
 195git-update-index                        plumbingmanipulators
 196git-update-ref                          plumbingmanipulators
 197git-update-server-info                  synchingrepositories
 198git-upload-archive                      synchelpers
 199git-upload-pack                         synchelpers
 200git-var                                 plumbinginterrogators
 201git-verify-pack                         plumbinginterrogators
 202git-verify-tag                          ancillaryinterrogators
 203git-whatchanged                         ancillaryinterrogators
 204git-write-tree                          plumbingmanipulators