5 Star 31 Fork 6

Gitee 极速下载/Git-for-Windows

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/git-for-windows/git
克隆/下载
generate-cmdlist.sh 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/sh
die () {
echo "$@" >&2
exit 1
}
command_list () {
while read cmd rest
do
case "$cmd" in
"#"* | '')
# Ignore comments and allow empty lines
continue
;;
*)
case "$exclude_programs" in
*":$cmd:"*)
;;
*)
echo "$cmd $rest"
;;
esac
esac
done <"$1"
}
category_list () {
echo "$1" |
cut -d' ' -f2- |
tr ' ' '\012' |
grep -v '^$' |
LC_ALL=C sort -u
}
define_categories () {
echo
echo "/* Command categories */"
bit=0
echo "$1" |
while read cat
do
echo "#define CAT_$cat (1UL << $bit)"
bit=$(($bit+1))
done
test "$bit" -gt 32 && die "Urgh.. too many categories?"
}
define_category_names () {
echo
echo "/* Category names */"
echo "static const char *category_names[] = {"
bit=0
echo "$1" |
while read cat
do
echo " \"$cat\", /* (1UL << $bit) */"
bit=$(($bit+1))
done
echo " NULL"
echo "};"
}
print_command_list () {
echo "static struct cmdname_help command_list[] = {"
echo "$1" |
while read cmd rest
do
synopsis=
while read line
do
case "$line" in
"$cmd - "*)
synopsis=${line#$cmd - }
break
;;
esac
done <"Documentation/$cmd.txt"
printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis"
printf " | CAT_%s" $rest
echo " },"
done
echo "};"
}
exclude_programs=:
while test "--exclude-program" = "$1"
do
shift
exclude_programs="$exclude_programs$1:"
shift
done
commands="$(command_list "$1")"
categories="$(category_list "$commands")"
echo "/* Automatically generated by generate-cmdlist.sh */
struct cmdname_help {
const char *name;
const char *help;
uint32_t category;
};
"
define_categories "$categories"
echo
define_category_names "$categories"
echo
print_command_list "$commands"
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors/Git-for-Windows.git
git@gitee.com:mirrors/Git-for-Windows.git
mirrors
Git-for-Windows
Git-for-Windows
main

搜索帮助

D67c1975 1850385 1daf7b77 1850385