Last active
February 24, 2025 16:33
-
-
Save reitzig/2885464e5c2fcc0f84bda9e1dae4f7b1 to your computer and use it in GitHub Desktop.
mise: MWE for project setup with project-local completions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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
💡 You can move everything except
[tools.lefthook]
to amise.local.toml
.💡 You can even move
[hooks]
and[tasks.install-local-completions]
to your user config.refs: jdx/mise#3757, jdx/mise#4514