Tidy up plan / install UX

This commit is contained in:
Ana Hobden 2022-11-09 10:09:20 -08:00
parent b123bbf285
commit c22f92aee4
2 changed files with 9 additions and 3 deletions

View file

@ -29,7 +29,7 @@ pub struct Install {
pub plan: Option<PathBuf>, pub plan: Option<PathBuf>,
#[clap(subcommand)] #[clap(subcommand)]
pub planner: BuiltinPlanner, pub planner: Option<BuiltinPlanner>,
} }
#[async_trait::async_trait] #[async_trait::async_trait]
@ -43,6 +43,13 @@ impl CommandExecute for Install {
explain, explain,
} = self; } = self;
let planner = match planner {
Some(planner) => planner,
None => BuiltinPlanner::default()
.await
.map_err(|e| eyre::eyre!(e))?,
};
let mut plan = match &plan { let mut plan = match &plan {
Some(plan_path) => { Some(plan_path) => {
let install_plan_string = tokio::fs::read_to_string(&plan_path) let install_plan_string = tokio::fs::read_to_string(&plan_path)

View file

@ -9,11 +9,10 @@ use crate::cli::CommandExecute;
/// Plan an install that can be repeated on an identical host later /// Plan an install that can be repeated on an identical host later
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
#[command(args_conflicts_with_subcommands = true, arg_required_else_help = true)]
pub struct Plan { pub struct Plan {
#[clap(subcommand)] #[clap(subcommand)]
pub planner: Option<BuiltinPlanner>, pub planner: Option<BuiltinPlanner>,
#[clap(env = "HARMONIC_PLAN")] #[clap(env = "HARMONIC_PLAN", default_value = "/dev/stdout")]
pub output: PathBuf, pub output: PathBuf,
} }