diff --git a/src/bin/flake-edit/cli.rs b/src/bin/flake-edit/cli.rs index 5fe4280..0f27cc6 100644 --- a/src/bin/flake-edit/cli.rs +++ b/src/bin/flake-edit/cli.rs @@ -11,12 +11,9 @@ pub struct CliArgs { /// Location of the `flake.nix` file, that will be used. #[arg(long)] flake: Option, - /// Print a diff of the changes, will set the apply flag to false. + /// Print a diff of the changes, will not write the changes to disk. #[arg(long, default_value_t = false)] diff: bool, - /// Whether to apply possible changes. - #[arg(long, default_value_t = true)] - apply: bool, #[command(subcommand)] subcommand: Command, @@ -53,10 +50,6 @@ impl CliArgs { pub fn diff(&self) -> bool { self.diff } - - pub fn apply(&self) -> bool { - self.apply - } } #[derive(Subcommand, Debug)] diff --git a/src/bin/flake-edit/main.rs b/src/bin/flake-edit/main.rs index 1fe9a3d..acf439c 100644 --- a/src/bin/flake-edit/main.rs +++ b/src/bin/flake-edit/main.rs @@ -133,8 +133,7 @@ fn main() -> eyre::Result<()> { let new = resulting_change; let diff = Diff::new(&old, &new); diff.compare(); - // Write the changes - } else if args.apply() { + } else { app.root.apply(&resulting_change)?; } } else if !args.list() && !args.update() && !args.pin() { @@ -170,8 +169,7 @@ fn main() -> eyre::Result<()> { let new = change; let diff = Diff::new(&old, &new); diff.compare(); - // Write the changes - } else if args.apply() { + } else { app.root.apply(&change)?; } } @@ -208,7 +206,7 @@ fn main() -> eyre::Result<()> { let new = change; let diff = Diff::new(&old, &new); diff.compare(); - } else if args.apply() { + } else { app.root.apply(&change)?; } }