Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 A CLI option to disable side-by-side mode #1280

Closed
gotgenes opened this issue Jan 12, 2023 · 4 comments
Closed

🚀 A CLI option to disable side-by-side mode #1280

gotgenes opened this issue Jan 12, 2023 · 4 comments

Comments

@gotgenes
Copy link

I have side-by-side enabled in my ~/.git/config, like so

[delta]
	side-by-side = true

I noticed there is a --side-by-side option that users can pass when invoking delta from the command line, but this option does not take a value; it works by presence/absence.

I'd like to sometimes override my config setting and disable side-by-side mode, but I do not see a command line option to do this. I was expecting something like --disable-side-by-side or --no-side-by-side, or some other "layout" option, but I didn't spot one in delta --help.

Am I missing the correct option to override and disable side-by-side mode from the CLI? If not, I'd appreciate considering adding such an option.

@gotgenes gotgenes changed the title A CLI option to disable side-by-side mode 🚀 🚀 A CLI option to disable side-by-side mode Jan 12, 2023
@dandavison
Copy link
Owner

Hi @gotgenes, thanks, this request makes sense. The things that's stopped me doing it is that it would bother me to have the special "disable" flag for side-by-side but not for all the other things that can be toggled. Instead, I suggest using the DELTA_FEATURES environment variable for this (this is what I do). I just added documentation of this technique to the side-by-side section of the manual: https://dandavison.github.io/delta/side-by-side-view.html

(but take a look at the "Features" section of the manual to understand the + syntax: https://dandavison.github.io/delta/features-named-groups-of-settings.html

@dandavison
Copy link
Owner

I believe the real solution here may be this open issue in the clap repo (the Rust CLI arg parsing library): clap-rs/clap#815

@gotgenes
Copy link
Author

@dandavison This was really helpful. I did not fully understand delta features before, and I was also unaware of the DELTA_FEATURES environment variable. This helps me. Thank you for your reply!

@gotgenes
Copy link
Author

I just ran into this situation again today with debugloop/telescope-undo.nvim, where I wanted to disable the side-by-side, which is still set to true in my Git config.

I discovered that

  1. Add support for automatic negation flags clap-rs/clap#815 is still open to this day, and
  2. the Git config setting takes precedence over the DELTA_FEATURES environment variable.

My expected precedence for most CLI tools in terms of options, where a lower number means more overriding precedence, would be:

  1. Values passed in as command-line options (--side-by-side)
  2. Values of environment variables (DELTA_FEATURES)
  3. Values from config files ($XDG_CONFIG_HOME/git/config)
  4. Default values in the code of the program.

delta currently seems to have flipped the precedence of the environment variables and the config values, at the moment. Would you consider changing the order of precedence? I hope that part is under delta's control, not clap's.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants