Skip to content

Commit 0e06aea

Browse files
committed
1 parent d7f76d6 commit 0e06aea

10 files changed

Lines changed: 524 additions & 302 deletions

File tree

bin/bash_completion.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#
2+
# Bash completion file for CakePHP console.
3+
# Copy this file to a file named `cake` under `/etc/bash_completion.d/`.
4+
# For more info check https://book.cakephp.org/5/en/console-commands/completion.html#how-to-enable-bash-autocompletion-for-the-cakephp-console
5+
#
6+
7+
_cake()
8+
{
9+
local cur prev opts cake
10+
COMPREPLY=()
11+
cake="${COMP_WORDS[0]}"
12+
cur="${COMP_WORDS[COMP_CWORD]}"
13+
prev="${COMP_WORDS[COMP_CWORD-1]}"
14+
15+
if [[ "$cur" == -* ]] ; then
16+
if [[ ${COMP_CWORD} = 1 ]] ; then
17+
opts=$(${cake} completion options)
18+
elif [[ ${COMP_CWORD} = 2 ]] ; then
19+
opts=$(${cake} completion options "${COMP_WORDS[1]}")
20+
else
21+
opts=$(${cake} completion options "${COMP_WORDS[1]}" "${COMP_WORDS[2]}")
22+
fi
23+
24+
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
25+
return 0
26+
fi
27+
28+
if [[ ${COMP_CWORD} = 1 ]] ; then
29+
opts=$(${cake} completion commands)
30+
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
31+
return 0
32+
fi
33+
34+
if [[ ${COMP_CWORD} = 2 ]] ; then
35+
opts=$(${cake} completion subcommands $prev)
36+
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
37+
if [[ $COMPREPLY = "" ]] ; then
38+
_filedir
39+
return 0
40+
fi
41+
return 0
42+
fi
43+
44+
return 0
45+
}
46+
47+
complete -F _cake cake bin/cake

bin/cake.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/php -q
22
<?php
3-
// Check platform requirements
4-
require dirname(__DIR__) . '/config/requirements.php';
53
require dirname(__DIR__) . '/vendor/autoload.php';
64

75
use App\Application;

0 commit comments

Comments
 (0)