Skip to content
Merged
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
26 changes: 26 additions & 0 deletions completion/available/artisan.completion.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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
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:]].*//")

Check warning

Code scanning / shellcheck

SC2034 Warning

commands appears unused. Verify use (or export if used externally).

# shellcheck disable=SC2034,SC2207
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
# shellcheck disable=SC2034,SC2207
# shellcheck disable=SC2016,SC2207

COMPREPLY=($(compgen -W '${commands}' -- "${cur}"))

Check warning

Code scanning / shellcheck

SC2016 Warning

Expressions don't expand in single quotes, use double quotes for that.
return 0
}

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