是否有现有的工具可以执行以下操作:
git-cat https://github.com/AbhishekSinhaCoder/Collection-of-Useful-Scripts
then it will run cat on each file in the repo?
像这样的东西可以工作,但它不会分离文件:
curl -s -H "Accept:application/vnd.github.v3.raw" https://api.github.com/repos/AbhishekSinhaCoder/Collection-of-Useful-Scripts/contents/ |
jq .[].download_url -r |
xargs curl 2>/dev/null |
bat
答案1
只需对命令行进行少量修改即可实现此目的:
curl -s -H "Accept:application/vnd.github.v3.raw" https://api.github.com/repos/AbhishekSinhaCoder/Collection-of-Useful-Scripts/contents/ |
jq .[].download_url -r |
xargs -L1 sh -c 'curl "$0" 2>/dev/null | bat'
话虽如此,如果有大量文件,您最终可能会因发出太多请求而受到速率限制,或者您的结果可能会因为分页而导致不完整。如果您不想承担完整克隆的费用,您可能希望进行浅克隆 ( git clone --depth=1
) 或部分克隆 ( )。git clone --filter=blob:none