Skip to content
Merged
Changes from 1 commit
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
27 changes: 27 additions & 0 deletions completion/available/artisan.completion.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# shellcheck shell=bash
cite "about-completion"
about-completion "Laravel artisan completion"

# Completion function for Laravel artisan
_artisan_completion() {
local cur commands
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"

# Only provide completions if artisan file exists in current directory or parent directories
if [[ ! -f "artisan" ]]; then
return 0
fi

# Get list of available artisan commands
# Use command prefix to bypass user aliases
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Use command prefix to bypass user aliases
# Use command prefix to bypass user aliases
# shellcheck disable=SC2034

commands=$(command php artisan --raw --no-ansi list 2> /dev/null | command sed "s/[[:space:]].*//g")

# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "${commands}" -- "${cur}"))
return 0
}

# Complete for both 'artisan' and common aliases 'art'
complete -F _artisan_completion artisan
complete -F _artisan_completion art
Loading