Move --machine to main options
This commit is contained in:
parent
707d55557e
commit
4e62839513
1 changed files with 5 additions and 5 deletions
10
src/main.rs
10
src/main.rs
|
|
@ -19,6 +19,9 @@ struct Opts {
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
json: bool,
|
json: bool,
|
||||||
|
|
||||||
|
#[arg(short, long)]
|
||||||
|
machine: Option<PathBuf>,
|
||||||
|
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: Command,
|
command: Command,
|
||||||
}
|
}
|
||||||
|
|
@ -34,9 +37,6 @@ struct ConfigOpts {
|
||||||
|
|
||||||
#[arg(short = '4', long)]
|
#[arg(short = '4', long)]
|
||||||
no_ipv6: bool,
|
no_ipv6: bool,
|
||||||
|
|
||||||
#[arg(short, long)]
|
|
||||||
machine: Option<PathBuf>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subcommand, Debug)]
|
#[derive(Subcommand, Debug)]
|
||||||
|
|
@ -96,7 +96,7 @@ fn list_locations(opts: &Opts) -> Result<(), anyhow::Error> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_config(_opts: &Opts, config_opts: &ConfigOpts) -> Result<(), anyhow::Error> {
|
fn get_config(opts: &Opts, config_opts: &ConfigOpts) -> Result<(), anyhow::Error> {
|
||||||
let locations = api::get_locations()?;
|
let locations = api::get_locations()?;
|
||||||
let location = locations
|
let location = locations
|
||||||
.locations
|
.locations
|
||||||
|
|
@ -104,7 +104,7 @@ fn get_config(_opts: &Opts, config_opts: &ConfigOpts) -> Result<(), anyhow::Erro
|
||||||
.find(|location| location.name == config_opts.location)
|
.find(|location| location.name == config_opts.location)
|
||||||
.ok_or_else(|| anyhow::anyhow!("no such location: {}", config_opts.location))?;
|
.ok_or_else(|| anyhow::anyhow!("no such location: {}", config_opts.location))?;
|
||||||
debug!("location = {:?}", &location);
|
debug!("location = {:?}", &location);
|
||||||
let keys = get_keys(config_opts.machine.as_ref())?;
|
let keys = get_keys(opts.machine.as_ref())?;
|
||||||
debug!("keys = {:?}", &keys);
|
debug!("keys = {:?}", &keys);
|
||||||
let addresses = api::add_ip(&config_opts.username, &config_opts.token, &keys.public_key)?;
|
let addresses = api::add_ip(&config_opts.username, &config_opts.token, &keys.public_key)?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue