Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/Documentation/cmd-list.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / Documentation / cmd-list.sh` 104 lines ยท 1609 bytes Raw Blame History 1 #!/bin/sh 2 3 set -e 4 5 format_one () { 6 source_dir="$1" 7 command="$2" 8 attributes="$3" 9 10 path="$source_dir/Documentation/$command.adoc" 11 if ! test -f "$path" 12 then 13 echo >&2 "No such file $path" 14 exit 1 15 fi 16 17 state=0 18 while read line 19 do 20 case "$state" in 21 0) 22 case "$line" in 23 git*\(*\)|scalar*\(*\)) 24 mansection="${line##*\(}" 25 mansection="${mansection%\)}" 26 ;; 27 NAME) 28 state=1;; 29 esac 30 ;; 31 1) 32 if test "$line" = "----" 33 then 34 state=2 35 fi 36 ;; 37 2) 38 description="$line" 39 break 40 ;; 41 esac 42 done <"$path" 43 44 if test -z "$mansection" 45 then 46 echo "No man section found in $path" >&2 47 exit 1 48 fi 49 50 if test -z "$description" 51 then 52 echo >&2 "No description found in $path" 53 exit 1 54 fi 55 56 case "$description" in 57 "$command - "*) 58 text="${description#$command - }" 59 60 printf "linkgit:%s[%s]::\n\t" "$command" "$mansection" 61 case "$attributes" in 62 *" deprecated "*) 63 printf "(deprecated) " 64 ;; 65 esac 66 printf "$text.\n\n" 67 ;; 68 *) 69 echo >&2 "Description does not match $command: $description" 70 exit 1 71 ;; 72 esac 73 } 74 75 source_dir="$1" 76 build_dir="$2" 77 shift 2 78 79 for out 80 do 81 category="${out#cmds-}" 82 category="${category%.adoc}" 83 path="$build_dir/$out" 84 85 while read command command_category attributes 86 do 87 case "$command" in 88 "#"*) 89 continue;; 90 esac 91 92 case "$command_category" in 93 "$category") 94 format_one "$source_dir" "$command" " $attributes ";; 95 esac 96 done <"$source_dir/command-list.txt" >"$build_dir/$out+" 97 98 if cmp "$build_dir/$out+" "$build_dir/$out" >/dev/null 2>&1 99 then 100 rm "$build_dir/$out+" 101 else 102 mv "$build_dir/$out+" "$build_dir/$out" 103 fi 104 done