eza-community / eza

A modern, maintained replacement for ls
https://eza.rocks
MIT License
8.76k stars 171 forks source link

feat: Make eza fail when built with -git and the --git parameter is given in the command line #1019

Open ericbn opened 3 weeks ago

ericbn commented 3 weeks ago

Currently how would we test if an eza binary was built with -git (git feature disabled)?

I see this fails as expected:

❯ eza --git
eza: Options --git and --git-ignore can't be used because `git` feature was disabled in this build of exa

But not these:

❯ eza --git --help
...
❯ eza --git --version
...

(Although all the above always fail when an unknown parameter is given, like --gix)

Can we make eza always fail when the --git parameter is given and it was build with -git?

daviessm commented 3 weeks ago

That's definitely one for after the clap integration, if that ever happens.

ericbn commented 2 weeks ago

How do you suggest we check if the git feature is enabled? Maybe by calling eza --git /dev/null?

Example of a shell script:

if eza --git /dev/null &>/dev/null; then
  alias ll='eza -l --git'
else
  alias ll='eza -l'
fi
alanatlab49 commented 4 days ago

How about don't fail, just ignore the option?