Skip to content

Commit b4f96ff

Browse files
committed
refactor: make auths claim github work with good default
1 parent 06b396e commit b4f96ff

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

  • crates/auths-cli/src/commands/id

crates/auths-cli/src/commands/id/claim.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,16 @@ fn github_client_id() -> String {
2626
pub struct ClaimCommand {
2727
#[command(subcommand)]
2828
pub platform: ClaimPlatform,
29-
30-
#[arg(long, default_value = DEFAULT_REGISTRY_URL)]
31-
pub registry: String,
3229
}
3330

3431
#[derive(Subcommand, Debug, Clone)]
3532
pub enum ClaimPlatform {
3633
/// Link your GitHub account to your identity.
37-
Github,
34+
Github {
35+
/// Registry URL to publish the claim to.
36+
#[arg(long, default_value = DEFAULT_REGISTRY_URL)]
37+
registry: String,
38+
},
3839
}
3940

4041
pub fn handle_claim(
@@ -44,6 +45,10 @@ pub fn handle_claim(
4445
env_config: &EnvironmentConfig,
4546
now: chrono::DateTime<chrono::Utc>,
4647
) -> Result<()> {
48+
let registry_url = match &cmd.platform {
49+
ClaimPlatform::Github { registry } => registry.clone(),
50+
};
51+
4752
let ctx = build_auths_context(repo_path, env_config, Some(passphrase_provider))
4853
.context("Failed to build auths context")?;
4954

@@ -53,7 +58,7 @@ pub fn handle_claim(
5358

5459
let config = GitHubClaimConfig {
5560
client_id: github_client_id(),
56-
registry_url: cmd.registry.clone(),
61+
registry_url,
5762
scopes: "read:user gist".to_string(),
5863
};
5964

0 commit comments

Comments
 (0)