feat(cmd): add --force flag to install command
Some checks failed
ci / test (push) Has been cancelled

This commit is contained in:
MDietermann
2026-04-14 22:31:46 +02:00
parent ee3bb1d67c
commit 712f09a824

View File

@@ -108,6 +108,7 @@ func newInstallCmd() *cobra.Command {
dryRun bool dryRun bool
halt bool halt bool
noSudo bool noSudo bool
force bool
only []string only []string
skip []string skip []string
overlayPath string overlayPath string
@@ -174,12 +175,14 @@ func newInstallCmd() *cobra.Command {
Selected: selected, Selected: selected,
DryRun: dryRun, DryRun: dryRun,
HaltOnError: halt, HaltOnError: halt,
Force: force,
Reporter: reporter, Reporter: reporter,
}) })
} else { } else {
// TUI path: wizard → dashboard. If the user does not confirm, // TUI path: wizard → dashboard. If the user does not confirm,
// we exit cleanly with a zero-summary and no error. // we exit cleanly with a zero-summary and no error.
initial := tui.NewWizardState(cfg, reg) initial := tui.NewWizardState(cfg, reg)
initial.Force = force
// Pre-filter the wizard's module list by --only/--skip so the // Pre-filter the wizard's module list by --only/--skip so the
// user cannot accidentally widen selection in the TUI beyond // user cannot accidentally widen selection in the TUI beyond
// what they asked for on the CLI. // what they asked for on the CLI.
@@ -254,6 +257,7 @@ func newInstallCmd() *cobra.Command {
cmd.Flags().BoolVar(&dryRun, "dry-run", false, "show planned actions without applying") cmd.Flags().BoolVar(&dryRun, "dry-run", false, "show planned actions without applying")
cmd.Flags().BoolVar(&halt, "halt-on-error", false, "stop at first failure instead of continuing siblings") cmd.Flags().BoolVar(&halt, "halt-on-error", false, "stop at first failure instead of continuing siblings")
cmd.Flags().BoolVar(&noSudo, "no-sudo", false, "skip upfront sudo -v (for tests / containers with passwordless sudo)") cmd.Flags().BoolVar(&noSudo, "no-sudo", false, "skip upfront sudo -v (for tests / containers with passwordless sudo)")
cmd.Flags().BoolVar(&force, "force", false, "reapply every selected module, ignoring current state")
cmd.Flags().StringSliceVar(&only, "only", nil, "comma-separated module IDs to run (exclusive with --skip)") cmd.Flags().StringSliceVar(&only, "only", nil, "comma-separated module IDs to run (exclusive with --skip)")
cmd.Flags().StringSliceVar(&skip, "skip", nil, "comma-separated module IDs to skip") cmd.Flags().StringSliceVar(&skip, "skip", nil, "comma-separated module IDs to skip")
cmd.Flags().StringVar(&overlayPath, "config", "", "path to overlay.yaml (default: ~/.config/archduino/overlay.yaml)") cmd.Flags().StringVar(&overlayPath, "config", "", "path to overlay.yaml (default: ~/.config/archduino/overlay.yaml)")