From b4f96fffb746099508a1f7581a307a5068cf3fbd Mon Sep 17 00:00:00 2001 From: bordumb Date: Sun, 15 Mar 2026 00:30:36 +0000 Subject: [PATCH] refactor: make auths claim github work with good default --- crates/auths-cli/src/commands/id/claim.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/auths-cli/src/commands/id/claim.rs b/crates/auths-cli/src/commands/id/claim.rs index 8bfcad6f..42248b5e 100644 --- a/crates/auths-cli/src/commands/id/claim.rs +++ b/crates/auths-cli/src/commands/id/claim.rs @@ -26,15 +26,16 @@ fn github_client_id() -> String { pub struct ClaimCommand { #[command(subcommand)] pub platform: ClaimPlatform, - - #[arg(long, default_value = DEFAULT_REGISTRY_URL)] - pub registry: String, } #[derive(Subcommand, Debug, Clone)] pub enum ClaimPlatform { /// Link your GitHub account to your identity. - Github, + Github { + /// Registry URL to publish the claim to. + #[arg(long, default_value = DEFAULT_REGISTRY_URL)] + registry: String, + }, } pub fn handle_claim( @@ -44,6 +45,10 @@ pub fn handle_claim( env_config: &EnvironmentConfig, now: chrono::DateTime, ) -> Result<()> { + let registry_url = match &cmd.platform { + ClaimPlatform::Github { registry } => registry.clone(), + }; + let ctx = build_auths_context(repo_path, env_config, Some(passphrase_provider)) .context("Failed to build auths context")?; @@ -53,7 +58,7 @@ pub fn handle_claim( let config = GitHubClaimConfig { client_id: github_client_id(), - registry_url: cmd.registry.clone(), + registry_url, scopes: "read:user gist".to_string(), };