2017-02-21 68 views

回答

2

您可以使用List languages Github API,這將使你在這個回購使用該語言編寫的代碼的字節數所有語言:

GET https://api.github.com/repos/dotnet/corefx/languages 

,會給你:

{ 
    "C#": 131055040, 
    "C": 1078381, 
    "Visual Basic": 829607, 
    "C++": 622926, 
    "XSLT": 462336, 
    "OpenEdge ABL": 139178, 
    "Shell": 70286, 
    "CMake": 60136, 
    "PowerShell": 51624, 
    "DIGITAL Command Language": 26402, 
    "Groovy": 25726, 
    "Batchfile": 21796, 
    "Objective-C": 9455, 
    "Makefile": 9085, 
    "Roff": 4236, 
    "Perl": 3895, 
    "ASP": 1687, 
    "Python": 1535, 
    "1C Enterprise": 903, 
    "HTML": 653 
} 

隨着bash可以使用jq解析並選擇最大字節值的字段:

language=`curl -s https://api.github.com/repos/dotnet/corefx/languages | jq 'to_entries | max_by(.value) | .key'` 
echo "$language" 
+0

謝謝。我已經調查過API文檔。 它的工作原理! ps:謝謝jq – vladiqtx