Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions completions/just.fish
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
function __fish_just_complete_recipes
if string match -rq '(-f|--justfile)\s*=?(?<justfile>[^\s]+)' -- (string split -- ' -- ' (commandline -pc))[1]
set -fx JUST_JUSTFILE "$justfile"
end
printf "%s\n" (string split " " (just --summary))
set -l commandline (string split -- ' -- ' (commandline -pc))[1]
set -l justfile_path_args_regex '\s(?:-g|--global-justfile|(?:-f|--justfile)\s*=?[^\s]+)'
set -l filtered_commandline (string match -r $justfile_path_args_regex -- $commandline)

printf "%s\n" (string split " " (just (string split -n -- ' ' $filtered_commandline) --summary))
end

# don't suggest files right off
Expand Down
9 changes: 5 additions & 4 deletions src/completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,11 @@ mod tests {
}

const FISH_RECIPE_COMPLETIONS: &str = r#"function __fish_just_complete_recipes
if string match -rq '(-f|--justfile)\s*=?(?<justfile>[^\s]+)' -- (string split -- ' -- ' (commandline -pc))[1]
set -fx JUST_JUSTFILE "$justfile"
end
printf "%s\n" (string split " " (just --summary))
set -l commandline (string split -- ' -- ' (commandline -pc))[1]
set -l justfile_path_args_regex '\s(?:-g|--global-justfile|(?:-f|--justfile)\s*=?[^\s]+)'
set -l filtered_commandline (string match -r $justfile_path_args_regex -- $commandline)

printf "%s\n" (string split " " (just (string split -n -- ' ' $filtered_commandline) --summary))
end

# don't suggest files right off
Expand Down