Skip to content
This repository has been archived by the owner on May 29, 2022. It is now read-only.

Make --auth_token global to CLI #40

Closed
aslamplr opened this issue Jun 2, 2020 · 1 comment
Closed

Make --auth_token global to CLI #40

aslamplr opened this issue Jun 2, 2020 · 1 comment
Assignees
Labels

Comments

@aslamplr
Copy link
Owner

aslamplr commented Jun 2, 2020

Make --auth_token global to CLI

@aslamplr aslamplr self-assigned this Jun 2, 2020
@aslamplr
Copy link
Owner Author

aslamplr commented Jun 3, 2020

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.

@aslamplr aslamplr closed this as completed Jun 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant