Merge pull request #45 from DeterminateSystems/hoverbear/ds-436-tidy-up-plan-install-ux

Tidy up plan / install UX
This commit is contained in:
Ana Hobden 2022-11-10 09:07:18 -08:00 committed by GitHub
commit 86fba9d442
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View file

@ -12,8 +12,10 @@ use eyre::{eyre, WrapErr};
use crate::{cli::CommandExecute, interaction};
/// Execute an install (possibly using an existing plan)
///
/// To pass custom options, select a planner, for example `harmonic install linux-multi --help`
#[derive(Debug, Parser)]
#[command(args_conflicts_with_subcommands = true, arg_required_else_help = true)]
#[command(args_conflicts_with_subcommands = true)]
pub struct Install {
#[clap(
long,
@ -92,7 +94,12 @@ impl CommandExecute for Install {
.wrap_err("Reading plan")?;
serde_json::from_str(&install_plan_string)?
},
(None, None) => return Err(eyre!("`--plan` or a planner is required")),
(None, None) => {
let builtin_planner = BuiltinPlanner::default()
.await
.map_err(|e| eyre::eyre!(e))?;
builtin_planner.plan().await.map_err(|e| eyre!(e))?
},
(Some(_), Some(_)) => return Err(eyre!("`--plan` conflicts with passing a planner, a planner creates plans, so passing an existing plan doesn't make sense")),
};

View file

@ -9,7 +9,6 @@ use crate::cli::CommandExecute;
/// Plan an install that can be repeated on an identical host later
#[derive(Debug, Parser)]
#[command(arg_required_else_help = true)]
pub struct Plan {
#[clap(subcommand)]
pub planner: Option<BuiltinPlanner>,