aslamplr/gh-cli

Make `--auth_token` global to CLI

Closed this issue · 1 comments

Make --auth_token global to CLI

auth_token is required arg for all subcommands except for login (and help). Right now with clap-3.0.0-beta.1 we get the following error.

    #[clap(
        long = "auth_token",
        short = "t",
        value_name = "GH_ACCESS_TOKEN",
        env = "GH_ACCESS_TOKEN",
        hide_env_values = true,
        about = "Run gh-cli login or Generate access token - https://github.com/settings/tokens",
        takes_value = true,
        global = true,
    )]
    auth_token: String, // making this Option<String> wouldn't throw the error. But makes things more complicated like handling the case where it is not provided. 
thread 'main' panicked at 'Global arguments cannot be required.

	'auth-token' is marked as both global and required',

There is an open issue in clap-rs clap-rs/clap#1546 related to this.
Leaving the issue open.