diff --git a/Cargo.toml b/Cargo.toml index 327d0ae..102ef7f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +clap = { version = "4.4.2", features = ["derive"] } network-interface = "1.0.1" serde = { version = "1.0.188", features = ["derive"] } toml = "0.7.6" diff --git a/src/main.rs b/src/main.rs index e86b4bf..fe71ccd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,43 @@ mod collectors; pub mod configuration; +use clap::Parser; use collectors::{dmi_collector, network_collector}; use configuration::config_parser::set_up_configuration; + +/// The arguments that netbox-sync expects to get via the cli. +/// +/// Arguments can be passed like this: +/// +/// ``` +/// netbox-sync --uri --token +/// ``` +/// +/// These arguments override the ones defined in the `.nbs-config.toml`. +/// +/// # Members +/// +/// * `uri: String` - The URI to your Netbox instance. +/// * `token: String` - The authentication token for the netbox URI. +#[derive(Parser, Debug)] +#[command(author, version, about, long_about=None)] +struct Args { + /// URI to your Netbox instance + #[arg(short, long)] + uri: String, + + /// Your API authentication token + #[arg(short, long)] + token: String, +} + fn main() { + let args: Args = Args::parse(); + + println!("Uri: {}\nToken: {}", args.uri, args.token); + + let output: dmi_collector::DmiInformation = dmi_collector::construct_dmi_information(); println!("{:#?}", output);