Parse CLI arguments with clap
This commit is contained in:
parent
3a5d0deaa5
commit
f75c178f8f
2 changed files with 20 additions and 0 deletions
|
@ -2,3 +2,6 @@
|
||||||
name = "spaceapi2prometheus"
|
name = "spaceapi2prometheus"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
clap = { version = "4.2.7", features = ["cargo", "derive"] }
|
||||||
|
|
17
src/main.rs
Normal file
17
src/main.rs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
use clap::Parser;
|
||||||
|
|
||||||
|
#[derive(Parser)]
|
||||||
|
#[command(version, about)]
|
||||||
|
struct Cli {
|
||||||
|
/// SpaceAPI endpoint
|
||||||
|
#[arg(short, long)]
|
||||||
|
url: String,
|
||||||
|
|
||||||
|
/// Period of querying, in seconds
|
||||||
|
#[arg(short, long, default_value_t = 300)]
|
||||||
|
delay: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let cli = Cli::parse();
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue