-
Notifications
You must be signed in to change notification settings - Fork 8
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
Refactor checks for exa command & the --git option #3
Conversation
Hi @yhchen0906. Can we replace the EDIT: I see we cannot. See eza-community/eza#1019 |
Hi @ericbn, I found a way to check the availability of --git option without creating/listing temp directory. |
Hello @ericbn. I've seen your modifications. Unfortunately, aliases do not take effect within scripts, so your approach means the condition /bin/ls --git will always be evaluated as false. That's why my previous implementation used a function to avoid the issue of aliases not working in scripts. |
Oh, you're completely right. I forgot that aliases don't work in the same script after the script has been zcompiled. My bad! Just pushed a commit with the fix. |
Hi @ericbn # Ensure exa is available
if (( ${+commands[eza]} )); then
exa() { eza "$@"; }
elif (( ! ${+commands[exa]} )); then
return 1
fi since the original implementation prefers # Ensure exa is available
if (( ${+commands[eza]} )); then
alias ls='eza --group-directories-first'
elif (( ${+commands[exa]} )); then
alias ls='exa --group-directories-first'
else
return 1
fi Also, make sure to change the list command on line 12 as well :) EDIT: |
Very good point again! What if we change the first block to: # Ensure eza is available
if (( ! ${+commands[eza]} )); then
if (( ${+commands[exa]} )); then
eza() { exa "$@" }
else
return 1
fi
fi ? You're right about prefering eza over exa (in case both are available). I don't want to create a exa function if eza is installed though, since most users should be using eza by now and exa is deprecated. |
I see. In that case, this implementation does indeed meet expectations better. Thank you very much! |
Add a check for the
--git
option since it might not available in some platform (e.g. aarch64, arm)See: eza v0.18.11