-
Notifications
You must be signed in to change notification settings - Fork 224
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
fix(uninstall): fix uninstall completions #1869
Conversation
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesYou may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation |
if [ ! -z "$prefix" ]; then | ||
prefix="--prefix $prefix" | ||
fi | ||
versions=$(mise ls --installed $tool $prefix | awk '{print $2}' | sed '1!G;h;$!d') |
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.
Was also playing around with this. Does this work? ls
returns another format than ls-remote
. Also it potentially list missing versions.
My approach would have been
complete "tool@version" run=r#"
prev="{{words[PREV]}}"
cur="{{words[CURRENT]}}"
declare -a rm=("uninstall" "remove" "rm")
case $cur in
*@*)
tool="$(echo "$cur" | cut -d'@' -f1)"
prefix="$(echo "$cur" | cut -d'@' -f2)"
if [[ " ${rm[@]} " =~ " ${prev} " ]]; then
versions=$(mise ls --no-header $tool | grep -v '(missing)' | awk '{print $2}' | sed '1!G;h;$!d')
else
versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d')
fi
for version in $versions; do
echo "$tool@$version"
done
;;
*)
if [[ " ${rm[@]} " =~ " ${prev} " ]]; then
plugins=$(mise plugins --core --user)
else
plugins=$(mise plugins --all)
fi
for plugin in $plugins; do
echo "$plugin@"
done
;;
esac
"#
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.
it would work, but I'd be hesitant to hardcode the aliases in the extras file. One problem with my solution is it shows plugins that have no installed versions but I feel it's at least an improvement.
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.
ah i see, the --installed
flag filters the missing already. agree that hardcoding aliases is indeed not nice.
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.
another note is you never need to pass--no-header
, the header is omitted when it isn't a tty
Fixes #1861