aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/completions/heroku.fish
blob: 2d11b15bb12732bb3c48af59f1ee9e0e3115a8f3 (plain)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# Heroku toolbelt completions
# By Jason Brokaw (github.com/jbbrokaw)

function __fish_list_available_addons
    heroku addons:list | awk -F":" '/^[a-z]/ {print $1}'
end

function __fish_list_installed_addons
    heroku addons | awk '{if (NR>1) print $1}'
end

function __fish_list_heroku_apps
    heroku apps | awk '{if (NR>1) print $1}'
end

function __fish_list_heroku_config_keys
    heroku config | awk -F':' '{if (NR>1) print $1}'
end

function __fish_list_heroku_domains
    heroku domains | awk '{if (NR>1) print $1}'
end

function __fish_list_heroku_dynos
    heroku ps | awk -F':' '{if (NR>1) print $1}'
end

function __fish_list_heroku_releases
    heroku releases | awk '{if (NR>1) print $1}'
end

function __fish_heroku_needs_command
    set cmd (commandline -opc)
    if [ (count $cmd) -eq 1 ]
        return 0
    end
    return 1
end

function __fish_heroku_using_command
    set cmd (commandline -opc)
    if [ (count $cmd) -gt 1 ]
        if [ $argv[1] = $cmd[2] ]
            return 0
        end
    end
    return 1
end

set -l heroku_looking -c heroku -n '__fish_heroku_needs_command'

# Main commands
complete $heroku_looking -xa addons -d 'list installed addons'
complete $heroku_looking -xa apps -d 'manage apps (create, destroy)'
complete $heroku_looking -xa auth -d 'authentication (login, logout)'
complete $heroku_looking -xa config -d 'manage app config vars'
complete $heroku_looking -xa domains -d 'manage custom domains'
complete $heroku_looking -xa logs -d 'display logs for an app'
complete $heroku_looking -xa ps -d 'manage dynos (dynos, workers)'
complete $heroku_looking -xa releases -d 'manage app releases'
complete $heroku_looking -xa run -d 'run one-off commands (console, rake)'
complete $heroku_looking -xa sharing -d 'manage collaborators on an app'

# Additional topics:

complete $heroku_looking -xa certs -d 'manage ssl endpoints for an app'
complete $heroku_looking -xa drains -d 'display syslog drains for an app'
complete $heroku_looking -xa features -d 'manage optional features'
complete $heroku_looking -xa fork -d 'clone an existing app'
complete $heroku_looking -xa help -d 'list commands and display help'
complete $heroku_looking -xa keys -d 'manage authentication keys'
complete $heroku_looking -xa labs -d 'manage optional features'
complete $heroku_looking -xa maintenance -d 'manage maintenance mode for an app'
complete $heroku_looking -xa members -d 'manage membership in organization accounts'
complete $heroku_looking -xa orgs -d 'manage organization accounts'
complete $heroku_looking -xa pg -d 'manage heroku-postgresql databases'
complete $heroku_looking -xa pgbackups -d 'manage backups of heroku postgresql databases'
complete $heroku_looking -xa plugins -d 'manage plugins to the heroku gem'
complete $heroku_looking -xa regions -d 'list available regions'
complete $heroku_looking -xa stack -d 'manage the stack for an app'
complete $heroku_looking -xa status -d 'check status of heroku platform'
complete $heroku_looking -xa twofactor
complete $heroku_looking -xa update -d 'update the heroku client'
complete $heroku_looking -xa version -d 'display version'

complete $heroku_looking -xa git:clone -d "APP DIRECTORY clones a heroku app to your local machine at DIRECTORY (defaults to app name)"
complete $heroku_looking -xa git:remote -d "adds a git remote to an app repo (-a APP)"

# Addons subcommands
complete $heroku_looking -xa addons:add -d 'install an addon'
complete -c heroku -n '__fish_heroku_using_command addons:add' -fa '(__fish_list_available_addons)'

complete $heroku_looking -xa addons:docs -d "open an addon's documentation in your browser"
complete -c heroku -n '__fish_heroku_using_command addons:docs' -fa '(__fish_list_installed_addons)'

complete $heroku_looking -xa addons:downgrade -d 'downgrade an existing addon'
complete -c heroku -n '__fish_heroku_using_command addons:downgrade' -fa '(__fish_list_installed_addons)'

complete $heroku_looking -xa addons:list -d 'list all available addons'

complete $heroku_looking -xa addons:open -d "open an addon's dashboard in your browser"
complete -c heroku -n '__fish_heroku_using_command addons:open' -fa '(__fish_list_installed_addons)'

complete $heroku_looking -xa addons:remove -d 'uninstall one or more addons'
complete -c heroku -n '__fish_heroku_using_command addons:remove' -fa '(__fish_list_installed_addons)'

complete $heroku_looking -xa addons:upgrade -d 'upgrade an existing addon'
complete -c heroku -n '__fish_heroku_using_command addons:upgrade' -fa '(__fish_list_installed_addons)'

# Apps options and subcommands
complete -c heroku -n '__fish_heroku_using_command apps' -s o -l org -l ORG    -d "the org to list the apps for"
complete -c heroku -n '__fish_heroku_using_command apps' -s A -l all -d "list all apps in the org. Not just joined apps"
complete -c heroku -n '__fish_heroku_using_command apps' -s p -l personal -d "list apps in personal account when a default org is set"

complete $heroku_looking -xa apps:create -d "create a new app (takes name)"

complete $heroku_looking -xa apps:destroy -d " permanently destroy an app (--app APP)"
complete -c heroku -n '__fish_heroku_using_command apps:destroy' -l app -s a -xa '(__fish_list_heroku_apps)'

complete $heroku_looking -xa apps:info -d "show detailed app information"

complete $heroku_looking -xa apps:join -d " add yourself to an organization app (--app APP)"
complete -c heroku -n '__fish_heroku_using_command apps:join' -l app -s a

complete $heroku_looking -xa apps:leave -d " remove yourself from an organization app (--app APP)"
complete -c heroku -n '__fish_heroku_using_command apps:leave' -l app -s a -xa '(__fish_list_heroku_apps)'

complete $heroku_looking -xa apps:lock -d " lock an organization app to restrict access"
complete -c heroku -n '__fish_heroku_using_command apps:lock' -l app -s a -xa '(__fish_list_heroku_apps)'

complete $heroku_looking -xa apps:open -d " open the app in a web browser"
complete -c heroku -n '__fish_heroku_using_command apps:open' -l app -s a -xa '(__fish_list_heroku_apps)'

complete $heroku_looking -xa apps:rename -d " rename the app (apps:rename newname --app oldname)"
complete -c heroku -n '__fish_heroku_using_command apps:rename' -l app -s a -xa '(__fish_list_heroku_apps)'

complete $heroku_looking -xa apps:unlock -d " unlock an organization app so that any org member can join it"
complete -c heroku -n '__fish_heroku_using_command apps:unlock' -l app -s a -xa '(__fish_list_heroku_apps)'

# Auth subcommands
complete $heroku_looking -xa auth:login -d "log in with your heroku credentials"
complete $heroku_looking -xa auth:logout -d "clear local authentication credentials"
complete $heroku_looking -xa auth:token -d "display your api token"
complete $heroku_looking -xa auth:whoami -d "display your heroku email address"


# Config options and subcommands
complete -c heroku -n '__fish_heroku_using_command config' -s s -l shell -d "output config vars in shell format"

complete $heroku_looking -xa config:get -d "display a config value for an app"
complete -c heroku -n '__fish_heroku_using_command config:get' -xa '(__fish_list_heroku_config_keys)' -d "display a config value for an app"

complete $heroku_looking -xa config:set -d "set one or more config vars (KEY=VALUE)"
complete -c heroku -n '__fish_heroku_using_command config:set' -fa '(__fish_list_heroku_config_keys)' -d "set one or more config vars (KEY=VALUE)"

complete $heroku_looking -xa config:unset -d "unset one or more config vars"
complete -c heroku -n '__fish_heroku_using_command config:unset' -fa '(__fish_list_heroku_config_keys)' -d "unset one or more config vars"

# Domains subcommands
complete $heroku_looking -xa domains:add -d "add a custom domain to an app"
complete $heroku_looking -xa domains:clear -d "remove all custom domains from an app"
complete $heroku_looking -xa domains:remove -d "remove a custom domain from an app"
complete -c heroku -n '__fish_heroku_using_command domains:remove' -fa '(__fish_list_heroku_domains)' -d "remove a custom domain from an app"

# Logs options
complete -c heroku -n '__fish_heroku_using_command logs' -s n -l num -l NUM -d "the number of lines to display"
complete -c heroku -n '__fish_heroku_using_command logs' -s p -l ps -l PS -d "only display logs from the given process"
complete -c heroku -n '__fish_heroku_using_command logs' -s s -l source -l SOURCE -d "only display logs from the given source"
complete -c heroku -n '__fish_heroku_using_command logs' -s t -l tail -d "continually stream logs"

# PS subcommands
complete $heroku_looking -xa ps:resize -d "resize dynos to the given size (DYNO1=1X|2X|PX)"
complete -c heroku -n '__fish_heroku_using_command ps:resize' -fa '(__fish_list_heroku_dynos)' -d "resize dynos to the given size (DYNO1=1X|2X|PX)"

complete $heroku_looking -xa ps:restart -d "restart an app dyno"
complete -c heroku -n '__fish_heroku_using_command ps:restart' -fa '(__fish_list_heroku_dynos)' -d "restart an app dyno"

complete $heroku_looking -xa ps:scale -d "scale dynos by the given amount (DYNO1=AMOUNT1)"
complete -c heroku -n '__fish_heroku_using_command ps:scale' -fa '(__fish_list_heroku_dynos)' -d "scale dynos by the given amount (DYNO1=AMOUNT1)"

complete $heroku_looking -xa ps:stop -d "stop an app dyno"
complete -c heroku -n '__fish_heroku_using_command ps:stop' -fa '(__fish_list_heroku_dynos)' -d "stop an app dyno"

# Releases options and subcommands
complete -c heroku -n '__fish_heroku_using_command releases' -s n -l num -l NUM -d "number of releases to show, maximum 50"

complete $heroku_looking -xa releases:info -d "view detailed information for a release"
complete -c heroku -n '__fish_heroku_using_command releases:info' -fa '(__fish_list_heroku_releases)' -d "view detailed information for a release"

complete $heroku_looking -xa releases:rollback -d "roll back to an older release"
complete -c heroku -n '__fish_heroku_using_command releases:rollback' -fa '(__fish_list_heroku_releases)' -d "roll back to an older release"

# Run options and subcommands
complete -c heroku -n '__fish_heroku_using_command run' -s s -l size -l SIZE -d "specify dyno size"

complete $heroku_looking -xa run:console -d "open a remote console session (with optional COMMAND)"
complete $heroku_looking -xa run:detached -d "run a detached dyno, where output is sent to your logs"
# complete $heroku_looking -xa run:rake -d "WARNING: `heroku run:rake` has been deprecated. Please use `heroku run rake` instead."
complete -c heroku -n '__fish_heroku_using_command run:detached' -s t -l tail -d "stream logs for the dyno"

# Sharing subcommands
complete $heroku_looking -xa sharing:add -d "add a collaborator to an app"
complete $heroku_looking -xa sharing:remove -d "remove a collaborator from an app"
complete $heroku_looking -xa sharing:transfer -d "transfers an app to another user or an organization."