forked from lix-project/lix-installer
Merge pull request #40 from DeterminateSystems/hoverbear/ds-430-plan-ux-refinement
Refine plan subcommand UX
This commit is contained in:
commit
b123bbf285
|
@ -9,19 +9,19 @@ use crate::cli::CommandExecute;
|
|||
|
||||
/// Plan an install that can be repeated on an identical host later
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(multicall = true)]
|
||||
#[command(args_conflicts_with_subcommands = true, arg_required_else_help = true)]
|
||||
pub struct Plan {
|
||||
#[clap(subcommand)]
|
||||
pub planner: Option<BuiltinPlanner>,
|
||||
#[clap(env = "HARMONIC_PLAN")]
|
||||
pub plan: PathBuf,
|
||||
pub output: PathBuf,
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl CommandExecute for Plan {
|
||||
#[tracing::instrument(skip_all, fields())]
|
||||
async fn execute(self) -> eyre::Result<ExitCode> {
|
||||
let Self { planner, plan } = self;
|
||||
let Self { planner, output } = self;
|
||||
|
||||
let planner = match planner {
|
||||
Some(planner) => planner,
|
||||
|
@ -33,7 +33,7 @@ impl CommandExecute for Plan {
|
|||
let install_plan = planner.plan().await.map_err(|e| eyre::eyre!(e))?;
|
||||
|
||||
let json = serde_json::to_string_pretty(&install_plan)?;
|
||||
tokio::fs::write(plan, json)
|
||||
tokio::fs::write(output, json)
|
||||
.await
|
||||
.wrap_err("Writing plan")?;
|
||||
|
||||
|
|
Loading…
Reference in a new issue