Skip to content

Instantly share code, notes, and snippets.

@jonashaag
Created October 8, 2022 10:45
Show Gist options
  • Save jonashaag/a66b6d7ac48daed35bbd8f580299cc30 to your computer and use it in GitHub Desktop.
Save jonashaag/a66b6d7ac48daed35bbd8f580299cc30 to your computer and use it in GitHub Desktop.
function __micromamba_completion
set -l args (commandline -ocp)
# TODO: micromamba completer should be able to ignore micromamba program name (first arg)
set -e args[1]
set -l suggestions ($MAMBA_EXE completer $args (commandline -t))
# TODO: micromamba completer should output lines not columnified
if echo "$suggestions" | grep -q " "
set suggestions (string split " " "$suggestions")
end
for suggestion in $suggestions
# TODO: Remove trailing whitespace from micromamba completer output
string trim --right -- "$suggestion"
end
return 0
# TODO: Support -p with __fish_complete_directories
# TODO: Support -f etc with __fish_complete_path
end
complete --no-files --command micromamba --arguments "(__micromamba_completion)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment