Plan prompts for sudo (#639)

* Plan prompts for sudo

* clippy/fmt
This commit is contained in:
Ana Hobden 2023-09-22 11:08:01 -07:00 committed by GitHub
parent 8911329beb
commit 1da69eef4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,6 @@
use std::{path::PathBuf, process::ExitCode}; use std::{path::PathBuf, process::ExitCode};
use crate::{error::HasExpectedErrors, BuiltinPlanner}; use crate::{cli::ensure_root, error::HasExpectedErrors, BuiltinPlanner};
use clap::Parser; use clap::Parser;
use eyre::WrapErr; use eyre::WrapErr;
@ -32,6 +32,8 @@ impl CommandExecute for Plan {
async fn execute(self) -> eyre::Result<ExitCode> { async fn execute(self) -> eyre::Result<ExitCode> {
let Self { planner, output } = self; let Self { planner, output } = self;
ensure_root()?;
let planner = match planner { let planner = match planner {
Some(planner) => planner, Some(planner) => planner,
None => BuiltinPlanner::default().await?, None => BuiltinPlanner::default().await?,