Skip to content
Open
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
10 changes: 8 additions & 2 deletions completions/just.bash
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,20 @@ _just() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
else
local recipes=$(just --summary 2> /dev/null)
local recipes="$(just --summary 2> /dev/null)"

if echo "${cur}" | \grep -qF '/'; then
local path_prefix=$(echo "${cur}" | sed 's/[/][^/]*$/\//')
local recipes=$(just --summary 2> /dev/null -- "${path_prefix}")
local recipes="$(just --summary 2> /dev/null -- "${path_prefix}")"
local recipes=$(printf "${path_prefix}%s\t" $recipes)
fi

case "${prev}" in
--global-justfile | -g)
local recipes=$(just -g --summary 2>/dev/null)
;;
esac

if [[ $? -eq 0 ]]; then
COMPREPLY=( $(compgen -W "${recipes}" -- "${cur}") )
if type __ltrim_colon_completions &>/dev/null; then
Expand Down