Add more cli options
This commit is contained in:
@@ -21,10 +21,24 @@ pub fn execute_cmd() -> Command {
|
||||
.required(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("gitea-http-token")
|
||||
.long("gitea-http-token")
|
||||
Arg::new("gitea-api-token")
|
||||
.long("gitea-api-token")
|
||||
.action(ArgAction::Set)
|
||||
.env("GITEA_HTTP_TOKEN")
|
||||
.env("GITEA_API_TOKEN")
|
||||
.required(false),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("gitea-username")
|
||||
.long("gitea-username")
|
||||
.action(ArgAction::Set)
|
||||
.env("GITEA_USERNAME")
|
||||
.required(false),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("gitea-url")
|
||||
.long("gitea-url")
|
||||
.action(ArgAction::Set)
|
||||
.env("GITEA_URL")
|
||||
.required(false),
|
||||
)
|
||||
}
|
||||
@@ -34,13 +48,18 @@ pub async fn execute_subcommand(args: &ArgMatches) -> eyre::Result<()> {
|
||||
.get_one::<String>("action")
|
||||
.ok_or(eyre::anyhow!("--action is required"))?;
|
||||
|
||||
let gitea_http_token = args.get_one::<String>("gitea-http-token");
|
||||
let gitea_http_token = args.get_one::<String>("gitea-api-token");
|
||||
let gitea_username = args.get_one::<String>("gitea-username");
|
||||
let gitea_url = args.get_one::<String>("gitea-url");
|
||||
|
||||
let service_register = ServiceRegister::new(
|
||||
LocalGitProviderOptions { http_auth: None },
|
||||
DefaultGiteaClientOptions {
|
||||
url: "https://git.front.kjuulh.io/api/v1".into(),
|
||||
basicauth: gitea_http_token.map(|t| t.clone()),
|
||||
url: gitea_url.map(|g| g.clone()).unwrap_or("".into()),
|
||||
basicauth: gitea_username
|
||||
.zip(gitea_http_token)
|
||||
.map(|(u, ht)| format!("{}:{}", u, ht))
|
||||
.map(|t| t.clone()),
|
||||
},
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user