This PR fixes three issues I found while testing the new GitHub token reading from files:
The ~/ home directory shortcut was not expanded, for example in @~/secrets/github-token.
When loading a GitHub token from file, the newline/carriage-return at the end of the file were also read into the token.
When using the --rate option, the GitHub token stored in a config file was not used.
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.
This PR fixes three issues I found while testing the new GitHub token reading from files:
~/
home directory shortcut was not expanded, for example in@~/secrets/github-token
.--rate
option, the GitHub token stored in a config file was not used.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.