Skip to content

Instantly share code, notes, and snippets.

@morisono
Forked from reitzig/mise.toml
Created July 2, 2025 23:05
Show Gist options
  • Save morisono/1c488584d56e7705d1f2fda0a9dcc8ff to your computer and use it in GitHub Desktop.
Save morisono/1c488584d56e7705d1f2fda0a9dcc8ff to your computer and use it in GitHub Desktop.
mise: MWE for project setup with project-local completions
[env]
LOCAL_FISH_COMPLETION_DIR = "{{config_root}}/.config/fish/completions"
[hooks]
postinstall = 'mkdir -p "$LOCAL_FISH_COMPLETION_DIR"'
[tasks.install-local-completions]
description = 'Install shell completions into project directory'
hide = true
run = '''
{{arg(name="command")}} {{arg(name="completion_command", var=true)}} \
> "$LOCAL_FISH_COMPLETION_DIR/{{arg(name="command")}}.fish"
'''
[tools.lefthook]
version = "1.10.10"
postinstall = 'mise run install-local-completions lefthook completion fish'
# TODO: can we (trigger) change(s) in env vars from hooks?
# we want to (re-)source after writing completions!
# TODO: can we remove the completion (complete -e) on leave?
# not a big deal, ut would be cleaner
# add to ~/.config/fish/conf.d/source-completions.fish
function source_completions --on-variable LOCAL_FISH_COMPLETION_DIR
for cf in $LOCAL_FISH_COMPLETION_DIR/*.fish
# mise exec gum -- gum log --level=debug "loading completion "(basename $cf)
# TODO: log doesn't work?
source < $cf
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment