Skip to content

Interactive Progressive Apply Workflow with a one-by-one Diff #5034

Description

@konradodwrot

Hello chezmoi folks! I see opportunity to improve UX during applying config using your tool

Is your feature request related to a problem? Please describe.

Currently applying config of a bunch of files, espeically when diff is vast across multiple files, costs more time and actions than it could

Imagine there are 10 files to be changed, and I type chezmoi apply --verbose --interative, when I go over files I have to type d(iff) and a(pply) 10 times, it's 20 actions all together, with proposed improvement it could be reduced to 10 apply actions. Additionally when one considers to apply change it's helps to have diff visible.

Describe the solution you'd like

It'd be very natural to apply config via a workflow:

  1. show all files that are going to be changed, and which are already present on a system (perpahs grayed out)
  2. user starts iterating over files that have to be applied
  3. for each file diff is shown, followed by a prompt Apply <file>? \n yes/no/all/quit - without diff because it's already above

Describe alternatives you've considered

1A. One alternative is to have a custom script, but proposed workflow could improve UX for everyone

2A. Adjusting --verbose option to show a diff during apply by default

➜  chezmoi git:(main) ✗ chezmoi apply --verbose --interactive
Apply .config/zsh/custom/0_functions.zsh? 
# verbosity could be increased here, it could be benefitial to have a diff in this place
diff/yes/no/all/quit

could become:

➜  chezmoi git:(main) ✗ chezmoi apply --verbose --interactive
Applying .config/zsh/custom/0_functions.zsh

+chezmoi_check_apply_config() {
+    # take a look at the changes
+    chezmoi diff
+    # apply one by one interactively
+    chezmoi apply --verbose --interactive
+}
+

yes/no/all/quit

2B. Introduce level of verbosity to --verbose

➜  chezmoi git:(main) ✗ chezmoi apply --verbose="diffs" --interactive

2C. Introduce mode to --interactive

➜  chezmoi git:(main) ✗ chezmoi apply --verbose --interactive="show_diffs"

2D. Introduce --show-diff option to apply subcommand

I'm interested in your point of view, let me know what do you think

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions