zyedidia / eget

Easily install prebuilt binaries from GitHub.
MIT License
866 stars 39 forks source link

fix(config): expand home in GitHub token file read and use token for rate #88

Closed hhromic closed 10 months ago

hhromic commented 10 months ago

This PR fixes three issues I found while testing the new GitHub token reading from files:

For the second point I used strings.TrimRight(), which strips any of the \r\n runes. Therefore, the trimming works properly for all OS line-ending styles (Unix, Mac, Windows).

To fix the third point, I had to separate the loading of global options from project options into two different functions so the global options can be loaded earlier for the --rate option to have a populated GitHub token from a config file.