Skip to content

Commit 8b04693

Browse files
rylevMark-Simulacrum
authored andcommitted
Move to also use clap
1 parent 9f7bf3f commit 8b04693

File tree

3 files changed

+33
-96
lines changed

3 files changed

+33
-96
lines changed

Cargo.lock

Lines changed: 26 additions & 89 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

setup-deploy-keys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name = "deploy"
99
path = "src/deploy.rs"
1010

1111
[dependencies]
12-
structopt = "0.3"
12+
clap = { version = "4", features = ["env"] }
1313
chrono = "0.4"
1414
reqwest = { version = "0.11", features = ["blocking", "json"] }
1515
serde = { version = "1.0", features = ["derive"] }

setup-deploy-keys/src/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
use chrono::Utc;
2+
use clap::Parser;
23
use reqwest::{
34
blocking::Client,
45
header::{HeaderValue, ACCEPT, AUTHORIZATION, USER_AGENT},
56
};
67
use std::error::Error;
78
use std::fs;
89
use std::process::Command;
9-
use structopt::StructOpt;
1010

11-
#[derive(StructOpt)]
11+
#[derive(Parser)]
1212
struct Cli {
13-
#[structopt(help = "the name of the repository to setup")]
13+
#[clap(help = "the name of the repository to setup")]
1414
repo: String,
15-
#[structopt(long = "github-token", env = "GITHUB_TOKEN", help = "GitHub API key")]
15+
#[clap(long = "github-token", env = "GITHUB_TOKEN", help = "GitHub API key")]
1616
github_token: String,
17-
#[structopt(long = "rsa")]
17+
#[clap(long = "rsa")]
1818
rsa: bool,
1919
}
2020

2121
fn main() -> Result<(), Box<dyn Error>> {
22-
let cli = Cli::from_args();
22+
let cli = Cli::parse();
2323
let date = Utc::today().format("%Y-%m-%d");
2424
let comment = format!("{} {}", cli.repo, date);
2525

0 commit comments

Comments
 (0)