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

Allow deactivate features by command line arguments #492

Closed
przepompownia opened this issue Jan 7, 2021 · 3 comments
Closed

Allow deactivate features by command line arguments #492

przepompownia opened this issue Jan 7, 2021 · 3 comments

Comments

@przepompownia
Copy link

Example: I have activated side-by-side in ~/.gitconfig and would like to deactivate it in some usage (e.g. when run from FZF).

I did not found how to deactivate single option and to keep the rest from the config.

Some CLI-s allows deactivating their features by adding no- prefix.

@dandavison
Copy link
Owner

dandavison commented Jan 7, 2021

Hi @przepompownia, you're right that this isn't obvious currently! Try this:

[delta]
    features = normal-delta-usage

[delta "normal-delta-usage"]
    side-by-side = true

[delta "fzf"]
    side-by-side = false

Now delta --features=fzf will not have side-by-side. You can also use the env var:, e.g. DELTA_FEATURES=fzf git show.
Does that solve it for you?

To read more about delta "custom features", see https://github.com/dandavison/delta#custom-features and dandavison/magit-delta#13 (comment). You could also look at the work-in-progress user-contributed themes file, which is implemented using custom features.

Sorry, that it's a bit convoluted currently. Part of the issue is that the main rust CLI library doesn't yet support automatic negating of boolean flags via --no-* versions, see clap-rs/clap#815.

@przepompownia
Copy link
Author

Hi @dandavison It is good to know about using custom feature. Thanks for explaining how to use it.

It works after upgrading from 0.4.4. to 0.5.1. Setting DELTA_FEATURES inside vim is enough to resolve my source problem.

@dandavison
Copy link
Owner

Great, glad that solves it for you.

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