-
-
Save morisono/1c488584d56e7705d1f2fda0a9dcc8ff to your computer and use it in GitHub Desktop.
mise: MWE for project setup with project-local completions
This file contains hidden or 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 hidden or 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