-
Notifications
You must be signed in to change notification settings - Fork 1
/
_hanami
82 lines (77 loc) · 2.56 KB
/
_hanami
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#compdef hanami
#autoload
# hanami zsh completion
local curcontext="$curcontext" state line _opts ret=1
_arguments -C -A "-v" -A "--version" \
'(- 1 *)'{-v,--version}'[display version information]' \
'1: :->cmds' \
'*:: :->args' && ret=0
case $state in
cmds)
_values "hanami command" \
"new[Generate new hanami project]" \
"generate[Generate part of hanami project]" \
"destroy[Destroy part of hanami project]" \
"db[DB specific commands]" \
"assets[Assets specific commands]" \
"routes[Returns list of all project routes]" \
"version[Display current hanami version]" \
"console[Run hanami console]"
ret=0
;;
args)
case $line[1] in
help)
_values 'commands' \
'new' \
'generate' \
'destroy' \
'db' \
'assets' \
'routes' \
'version' && ret=0
;;
new)
_arguments \
'(--test)--test=-[generate project for a specific test framework]' \
'(--database)--database=-[generate project for a specific database]'
ret=0
;;
generate)
_values "hanami generate command" \
"app[Generate new hanami app]" \
"action[Generate new hanami action]" \
"model[Generate new hanami model]" \
"migration[Generate new hanami migration]" \
"mailer[Generate new hanami mailer]" \
"secret[Generate new hanami secret]"
ret=0
;;
destroy)
_values "hanami destroy command" \
"app[Destroy new hanami app]" \
"action[Destroy new hanami action]" \
"model[Destroy new hanami model]" \
"migration[Destroy new hanami migration]" \
"mailer[Destroy new hanami mailer]"
ret=0
;;
db)
_values "hanami db command" \
"create[Create the database for the current environment]" \
"drop[Drop the existing database for the current environment]" \
"migrate[Run migrations found in db/migrations]" \
"prepare[Prepares database for the current environment]" \
"apply[Dumps a fresh schema into db/schema.sql]" \
"version[Prints current database version]"
ret=0
;;
assets)
_values "hanami assets command" \
"precompile[precompiles and copies all the assets from all the applications and third party gems]"
ret=0
;;
esac
;;
esac
return ret