我有这个 zsh 函数,它可以从 github 项目的根链接中找到自述文件(例如,https ://github.com/Mortennn/Dozer -> https://github.com/Mortennn/Dozer/blob/master/README。 MD)。因为这个文件的大小写不一致(例如,readme Readme READMe
),我目前正在尝试所有可能的大小写排列,这非常慢。
有没有更有效的解决方案?
#There are lots of stuff here, just ignore them. You can ignore this code completely, too. The question is self-sufficient.
for readme in "${(0@)$(permute-case readme)}"
do
i2="${i}/blob/master/${readme}.md"
silence wget --spider "$i2" && break
i2="${i}/blob/master/${readme}.rst"
silence wget --spider "$i2" && break
done