fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Fabian BoehmReformat share/**.fish with newlines collapsed78c948282

master
11.4 KiB214 linesraw
1# Heroku toolbelt completions
2# By Jason Brokaw (github.com/jbbrokaw)
3
4function __fish_list_available_addons
5    heroku addons:list | awk -F":" '/^[a-z]/ {print $1}'
6end
7
8function __fish_list_installed_addons
9    heroku addons | awk '{if (NR>1) print $1}'
10end
11
12function __fish_list_heroku_apps
13    heroku apps | awk '{if (NR>1) print $1}'
14end
15
16function __fish_list_heroku_config_keys
17    heroku config | awk -F':' '{if (NR>1) print $1}'
18end
19
20function __fish_list_heroku_domains
21    heroku domains | awk '{if (NR>1) print $1}'
22end
23
24function __fish_list_heroku_dynos
25    heroku ps | awk -F':' '{if (NR>1) print $1}'
26end
27
28function __fish_list_heroku_releases
29    heroku releases | awk '{if (NR>1) print $1}'
30end
31
32function __fish_heroku_needs_command
33    set -l cmd (commandline -xpc)
34    if test (count $cmd) -eq 1
35        return 0
36    end
37    return 1
38end
39
40function __fish_heroku_using_command
41    set -l cmd (commandline -xpc)
42    if test (count $cmd) -gt 1
43        if test $argv[1] = $cmd[2]
44            return 0
45        end
46    end
47    return 1
48end
49
50set -l heroku_looking -c heroku -n __fish_heroku_needs_command
51
52# Main commands
53complete $heroku_looking -xa addons -d 'list installed addons'
54complete $heroku_looking -xa apps -d 'manage apps (create, destroy)'
55complete $heroku_looking -xa auth -d 'authentication (login, logout)'
56complete $heroku_looking -xa config -d 'manage app config vars'
57complete $heroku_looking -xa domains -d 'manage custom domains'
58complete $heroku_looking -xa logs -d 'display logs for an app'
59complete $heroku_looking -xa ps -d 'manage dynos (dynos, workers)'
60complete $heroku_looking -xa releases -d 'manage app releases'
61complete $heroku_looking -xa run -d 'run one-off commands (console, rake)'
62complete $heroku_looking -xa sharing -d 'manage collaborators on an app'
63
64# Additional topics:
65
66complete $heroku_looking -xa certs -d 'manage ssl endpoints for an app'
67complete $heroku_looking -xa drains -d 'display syslog drains for an app'
68complete $heroku_looking -xa features -d 'manage optional features'
69complete $heroku_looking -xa fork -d 'clone an existing app'
70complete $heroku_looking -xa help -d 'list commands and display help'
71complete $heroku_looking -xa keys -d 'manage authentication keys'
72complete $heroku_looking -xa labs -d 'manage optional features'
73complete $heroku_looking -xa maintenance -d 'manage maintenance mode for an app'
74complete $heroku_looking -xa members -d 'manage membership in organization accounts'
75complete $heroku_looking -xa orgs -d 'manage organization accounts'
76complete $heroku_looking -xa pg -d 'manage heroku-postgresql databases'
77complete $heroku_looking -xa plugins -d 'manage plugins to the heroku gem'
78complete $heroku_looking -xa regions -d 'list available regions'
79complete $heroku_looking -xa stack -d 'manage the stack for an app'
80complete $heroku_looking -xa status -d 'check status of heroku platform'
81complete $heroku_looking -xa update -d 'update the heroku client'
82complete $heroku_looking -xa version -d 'display version'
83
84complete $heroku_looking -xa git:clone -d "clones heroku application to machine at DIRECTORY. defaults to app name."
85complete $heroku_looking -xa git:remote -d "adds a git remote to an app repo (-a APP)"
86
87# Addons subcommands
88complete $heroku_looking -xa addons:add -d 'install an addon'
89complete -c heroku -n '__fish_heroku_using_command addons:add' -fa '(__fish_list_available_addons)'
90
91complete $heroku_looking -xa addons:docs -d "open an addon's documentation in your browser"
92complete -c heroku -n '__fish_heroku_using_command addons:docs' -fa '(__fish_list_installed_addons)'
93
94complete $heroku_looking -xa addons:downgrade -d 'downgrade an existing addon'
95complete -c heroku -n '__fish_heroku_using_command addons:downgrade' -fa '(__fish_list_installed_addons)'
96
97complete $heroku_looking -xa addons:list -d 'list all available addons'
98
99complete $heroku_looking -xa addons:open -d "open an addon's dashboard in your browser"
100complete -c heroku -n '__fish_heroku_using_command addons:open' -fa '(__fish_list_installed_addons)'
101
102complete $heroku_looking -xa addons:remove -d 'uninstall one or more addons'
103complete -c heroku -n '__fish_heroku_using_command addons:remove' -fa '(__fish_list_installed_addons)'
104
105complete $heroku_looking -xa addons:upgrade -d 'upgrade an existing addon'
106complete -c heroku -n '__fish_heroku_using_command addons:upgrade' -fa '(__fish_list_installed_addons)'
107
108# Apps options and subcommands
109complete -c heroku -n '__fish_heroku_using_command apps' -s o -l org -l ORG -d "the org to list the apps for"
110complete -c heroku -n '__fish_heroku_using_command apps' -s A -l all -d "list all apps in the org. Not just joined apps"
111complete -c heroku -n '__fish_heroku_using_command apps' -s p -l personal -d "list apps in personal account when a default org is set"
112
113complete $heroku_looking -xa apps:create -d "create a new app (takes name)"
114
115complete $heroku_looking -xa apps:destroy -d " permanently destroy an app (--app APP)"
116complete -c heroku -n '__fish_heroku_using_command apps:destroy' -l app -s a -xa '(__fish_list_heroku_apps)'
117
118complete $heroku_looking -xa apps:info -d "show detailed app information"
119
120complete $heroku_looking -xa apps:join -d " add yourself to an organization app (--app APP)"
121complete -c heroku -n '__fish_heroku_using_command apps:join' -l app -s a
122
123complete $heroku_looking -xa apps:leave -d " remove yourself from an organization app (--app APP)"
124complete -c heroku -n '__fish_heroku_using_command apps:leave' -l app -s a -xa '(__fish_list_heroku_apps)'
125
126complete $heroku_looking -xa apps:lock -d " lock an organization app to restrict access"
127complete -c heroku -n '__fish_heroku_using_command apps:lock' -l app -s a -xa '(__fish_list_heroku_apps)'
128
129complete $heroku_looking -xa apps:open -d " open the app in a web browser"
130complete -c heroku -n '__fish_heroku_using_command apps:open' -l app -s a -xa '(__fish_list_heroku_apps)'
131
132complete $heroku_looking -xa apps:rename -d " rename the app (apps:rename newname --app oldname)"
133complete -c heroku -n '__fish_heroku_using_command apps:rename' -l app -s a -xa '(__fish_list_heroku_apps)'
134
135complete $heroku_looking -xa apps:unlock -d " unlock an organization app so that any org member can join it"
136complete -c heroku -n '__fish_heroku_using_command apps:unlock' -l app -s a -xa '(__fish_list_heroku_apps)'
137
138# Auth subcommands
139complete $heroku_looking -xa auth:login -d "log in with your heroku credentials"
140complete $heroku_looking -xa auth:logout -d "clear local authentication credentials"
141complete $heroku_looking -xa auth:token -d "display your api token"
142complete $heroku_looking -xa auth:whoami -d "display your heroku email address"
143
144# Config options and subcommands
145complete -c heroku -n '__fish_heroku_using_command config' -s s -l shell -d "output config vars in shell format"
146
147complete $heroku_looking -xa config:get -d "display a config value for an app"
148complete -c heroku -n '__fish_heroku_using_command config:get' -xa '(__fish_list_heroku_config_keys)' -d "display a config value for an app"
149
150complete $heroku_looking -xa config:set -d "set one or more config vars (KEY=VALUE)"
151complete -c heroku -n '__fish_heroku_using_command config:set' -fa '(__fish_list_heroku_config_keys)' -d "set one or more config vars (KEY=VALUE)"
152
153complete $heroku_looking -xa config:unset -d "unset one or more config vars"
154complete -c heroku -n '__fish_heroku_using_command config:unset' -fa '(__fish_list_heroku_config_keys)' -d "unset one or more config vars"
155
156# Domains subcommands
157complete $heroku_looking -xa domains:add -d "add a custom domain to an app"
158complete $heroku_looking -xa domains:clear -d "remove all custom domains from an app"
159complete $heroku_looking -xa domains:remove -d "remove a custom domain from an app"
160complete -c heroku -n '__fish_heroku_using_command domains:remove' -fa '(__fish_list_heroku_domains)' -d "remove a custom domain from an app"
161
162# Logs options
163complete -c heroku -n '__fish_heroku_using_command logs' -s n -l num -l NUM -d "the number of lines to display"
164complete -c heroku -n '__fish_heroku_using_command logs' -s p -l ps -l PS -d "only display logs from the given process"
165complete -c heroku -n '__fish_heroku_using_command logs' -s s -l source -l SOURCE -d "only display logs from the given source"
166complete -c heroku -n '__fish_heroku_using_command logs' -s t -l tail -d "continually stream logs"
167
168# PG subcommands
169complete $heroku_looking -xa pg:backups -d "manage backups of heroku postgresql databases"
170complete $heroku_looking -xa pg:backups:cancel -d "cancel an in-progress backup or restore (default newest)"
171complete $heroku_looking -xa pg:backups:capture -d "capture a new backup"
172complete $heroku_looking -xa pg:backups:delete -d "delete a backup"
173complete $heroku_looking -xa pg:backups:download -d "downloads database backup"
174complete $heroku_looking -xa pg:backups:info -d "get information about a specific backup"
175complete $heroku_looking -xa pg:backups:restore -d "restore a backup (default latest) to a database"
176complete $heroku_looking -xa pg:backups:schedule -d "schedule daily backups for given database"
177complete $heroku_looking -xa pg:backups:schedules -d "list backup schedule"
178complete $heroku_looking -xa pg:backups:unschedule -d "stop daily backups"
179complete $heroku_looking -xa pg:backups:url -d "get secret but publicly accessible URL of a backup"
180
181# PS subcommands
182complete $heroku_looking -xa ps:resize -d "resize dynos to the given size (DYNO1=1X|2X|PX)"
183complete -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)"
184
185complete $heroku_looking -xa ps:restart -d "restart an app dyno"
186complete -c heroku -n '__fish_heroku_using_command ps:restart' -fa '(__fish_list_heroku_dynos)' -d "restart an app dyno"
187
188complete $heroku_looking -xa ps:scale -d "scale dynos by the given amount (DYNO1=AMOUNT1)"
189complete -c heroku -n '__fish_heroku_using_command ps:scale' -fa '(__fish_list_heroku_dynos)' -d "scale dynos by the given amount (DYNO1=AMOUNT1)"
190
191complete $heroku_looking -xa ps:stop -d "stop an app dyno"
192complete -c heroku -n '__fish_heroku_using_command ps:stop' -fa '(__fish_list_heroku_dynos)' -d "stop an app dyno"
193
194# Releases options and subcommands
195complete -c heroku -n '__fish_heroku_using_command releases' -s n -l num -l NUM -d "number of releases to show, maximum 50"
196
197complete $heroku_looking -xa releases:info -d "view detailed information for a release"
198complete -c heroku -n '__fish_heroku_using_command releases:info' -fa '(__fish_list_heroku_releases)' -d "view detailed information for a release"
199
200complete $heroku_looking -xa releases:rollback -d "roll back to an older release"
201complete -c heroku -n '__fish_heroku_using_command releases:rollback' -fa '(__fish_list_heroku_releases)' -d "roll back to an older release"
202
203# Run options and subcommands
204complete -c heroku -n '__fish_heroku_using_command run' -s s -l size -l SIZE -d "specify dyno size"
205
206complete $heroku_looking -xa run:console -d "open a remote console session (with optional COMMAND)"
207complete $heroku_looking -xa run:detached -d "run a detached dyno, where output is sent to your logs"
208# complete $heroku_looking -xa run:rake -d "WARNING: `heroku run:rake` has been deprecated. Please use `heroku run rake` instead."
209complete -c heroku -n '__fish_heroku_using_command run:detached' -s t -l tail -d "stream logs for the dyno"
210
211# Sharing subcommands
212complete $heroku_looking -xa sharing:add -d "add a collaborator to an app"
213complete $heroku_looking -xa sharing:remove -d "remove a collaborator from an app"
214complete $heroku_looking -xa sharing:transfer -d "transfers an app to another user or an organization."