-
Notifications
You must be signed in to change notification settings - Fork 1
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
Revert changes #4
base: main
Are you sure you want to change the base?
Conversation
Review changes with SemanticDiff. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still can make this generic because i.e. Debian will have fdfind
.
Something like this will be better
# Unalias existing aliases if they exist
unalias find 2>/dev/null
unalias fd 2>/dev/null
# Check if fd or fdfind is installed
if (( $+commands[fd] )); then
alias fd='fd'
elif (( $+commands[fdfind] )); then
alias fd='fdfind'
else
print "zsh-fd-plugin: neither 'fd' nor 'fdfind' found on path. Please install 'fd' before using this plugin." >&2
return 1
fi
Sure! |
Do you mean having that?
We are re-aliasing it if there is one anyway. The shell will use the last definition occurrence in I pushed some fix myself, but it seems that it introduced problem on Mac. So I want to have something more suitable. I'm thinking of more elegant way like that # Project: fd-zsh
# File: fd-zsh-plugin.zsh
# Author: Mohamed Elashri
# Email: [email protected]
# Unalias existing aliases if they exist
unalias find 2>/dev/null
unalias fd 2>/dev/null
# Check if fd or fdfind is installed
if (( $+commands[fd] )); then
alias fd='fd'
elif (( $+commands[fdfind] )); then
alias fd='fdfind'
else
echo "zsh-fd-plugin: neither 'fd' nor 'fdfind' found on path. Please install 'fd' before using this plugin." >&2
return 1
fi
# General aliases
alias find='fd'
alias fd='fd --color always' # Always colorize output by default
# Function to handle fd aliases
fd_aliases() {
case "$1" in
details) fd --list-details ;;
ext) fd --extension "$2" ;;
name) fd --glob "$2" ;;
case) fd --ignore-case ;;
hidden) fd --hidden ;;
abs) fd --absolute-path ;;
exec) fd --exec "$2" ;;
exclude) fd --exclude "$2" ;;
size) fd --size "$2" ;;
owner) fd --owner "$2" ;;
symbolic) fd --follow ;;
version) fd --version ;;
help) fd --help ;;
*) echo "Unknown option: $1" ;;
esac
}
# Aliases using the fd_aliases function
alias fd_details='fd_aliases details'
alias fd_ext='fd_aliases ext'
alias fd_name='fd_aliases name'
alias fd_case='fd_aliases case'
alias fd_hidden='fd_aliases hidden'
alias fd_abs='fd_aliases abs'
alias fd_exec='fd_aliases exec'
alias fd_exclude='fd_aliases exclude'
alias fd_size='fd_aliases size'
alias fd_owner='fd_aliases owner'
alias fd_symbolic='fd_aliases symbolic'
alias fd_version='fd_aliases version'
alias fd_help='fd_aliases help' |
Sure! |
Hi,
I think we need to revert these changes - they introduced errors when tested
Sorry about that!