Skip to content

Commit

Permalink
change external interface to take parsed Opts
Browse files Browse the repository at this point in the history
  • Loading branch information
nrdxp committed Nov 5, 2021
1 parent d630e13 commit 71edd4d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ use tokio::process::Command;
pub struct Opts {
/// The flake to deploy
#[clap(group = "deploy")]
target: Option<String>,
pub target: Option<String>,

/// A list of flakes to deploy alternatively
#[clap(long, group = "deploy")]
targets: Option<Vec<String>>,
pub targets: Option<Vec<String>>,

/// Override hostname used for the node
#[clap(long)]
hostname: Option<String>,
pub hostname: Option<String>,

#[clap(flatten)]
flags: data::Flags,
pub flags: data::Flags,

#[clap(flatten)]
generic_settings: settings::GenericSettings,
pub generic_settings: settings::GenericSettings,
}

/// Returns if the available Nix installation supports flakes
Expand Down Expand Up @@ -271,9 +271,9 @@ pub enum RunError {
RunDeploy(#[from] RunDeployError),
}

pub async fn run(args: Option<&ArgMatches>) -> Result<(), RunError> {
pub async fn run(args: Option<Opts>) -> Result<(), RunError> {
let opts = match args {
Some(o) => <Opts as FromArgMatches>::from_arg_matches(o).unwrap_or_default(),
Some(o) => o,
None => Opts::parse(),
};

Expand Down

0 comments on commit 71edd4d

Please sign in to comment.