Skip to content

Instantly share code, notes, and snippets.

@enlinea777
Forked from tuanpht/php-artisan-bash-completion.md
Last active February 16, 2021 20:42
Show Gist options
  • Select an option

  • Save enlinea777/d1137ba2913d48c1377e4d93731431d8 to your computer and use it in GitHub Desktop.

Select an option

Save enlinea777/d1137ba2913d48c1377e4d93731431d8 to your computer and use it in GitHub Desktop.
Bash-only Laravel Artisan tab auto-complete

usar auto completado de codigo en consola para laravel Laravel 8

para instalar en la consola Bash todas las opciones de autocompletado por tab Laravel Artisan autocomplete la solucion es instalar el script en el perfil de usuario ~/.bash_profile ( or similarly sourced file ) con esto artisan completará los comandos antecedentes en el sistema. OJO Solo en la carpeta del sistema de LARAVEL

_artisan()
{
    local arg="${COMP_LINE#php }"

    case "$arg" in
        artisan*)
            COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
            COMMANDS=`php artisan --raw --no-ansi list | sed "s/[[:space:]].*//g"`
            COMPREPLY=(`compgen -W "$COMMANDS" -- "${COMP_WORDS[COMP_CWORD]}"`)
            ;;
        *)
            COMPREPLY=( $(compgen -o default -- "${COMP_WORDS[COMP_CWORD]}") )
            ;;
        esac

    return 0
}
complete -F _artisan php
@enlinea777
Copy link
Author

Ubuntu
el archivo es ~/.profile
#Para recargar en consola
source ~/.profile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment