(argv: Argv<T>)
| 14 | |
| 15 | /** Sets up the `github-token` command option for the given Yargs instance. */ |
| 16 | export function addGithubTokenOption<T>(argv: Argv<T>) { |
| 17 | return ( |
| 18 | argv |
| 19 | // 'github-token' is casted to 'githubToken' to properly set up typings to reflect the key in |
| 20 | // the Argv object being camelCase rather than kebab case due to the `camel-case-expansion` |
| 21 | // config: https://github.com/yargs/yargs-parser#camel-case-expansion |
| 22 | .option('github-token' as 'githubToken', { |
| 23 | type: 'string', |
| 24 | default: '', |
| 25 | defaultDescription: '<LOCAL_TOKEN>', |
| 26 | description: 'Github token. If not set, token is retrieved from the environment variables.', |
| 27 | // We use the coerce function as a way of allowing the user to provide the value, otherwise |
| 28 | // looking for it in the environment. |
| 29 | coerce: configureGitClientWithTokenOrFromEnvironment, |
| 30 | }) |
| 31 | ); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * If the github token is able to be determined, either by being provided as a parameter or being |
no outgoing calls
no test coverage detected