434f3bc05c5245d7a27ab0bb1ede5b78acc370a4
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/docker/README.md b/plugins/docker/README.md
2new file mode 100644
3index 0000000000000000000000000000000000000000..231a6dcf5d1fc656e02ed0fcc98e606fd8109ce6
4--- /dev/null
5+++ b/plugins/docker/README.md
6@@ -0,0 +1,19 @@
7+## Docker autocomplete plugin
8+
9+- Adds autocomplete options for all docker commands.
10+- Will also show containerIDs and Image names where applicable
11+
12+####Shows help for all commands
13+
14+
15+
16+####Shows your downloaded images where applicable
17+
18+
19+
20+####Shows your running containers where applicable
21+
22+
23+
24+
25+Maintainer : Ahmed Azaan ([@aeonazaan](https://twitter.com/aeonazaan))
26diff --git a/plugins/docker/_docker b/plugins/docker/_docker
27new file mode 100644
28index 0000000000000000000000000000000000000000..f13f876cf9c97af4ed7d8598fba3325f60ac6cca
29--- /dev/null
30+++ b/plugins/docker/_docker
31@@ -0,0 +1,290 @@
32+#compdef docker
33+
34+# Docker autocompletion for oh-my-zsh
35+# Requires: Docker installed
36+# Author : Azaan (@aeonazaan)
37+
38+
39+# ----- Helper functions
40+# Output a selectable list of all running docker containers
41+__docker_containers() {
42+ declare -a cont_cmd
43+ cont_cmd=($(docker ps | awk 'NR>1{print $1":[CON("$1")"$2"("$3")]"}'))
44+ _describe 'containers' cont_cmd
45+}
46+
47+# output a selectable list of all docker images
48+__docker_images() {
49+ declare -a img_cmd
50+ img_cmd=($(docker images | awk 'NR>1{print $1}'))
51+ _describe 'images' img_cmd
52+}
53+
54+# ----- Commands
55+# Seperate function for each command, makes extension easier later
56+# ---------------------------
57+__attach() {
58+ __docker_containers
59+}
60+
61+__build() {
62+ _arguments \
63+ '-q=false[Suppress verbose build output]' \
64+ '-t="[fuck to be applied to the resulting image in case of success]' \
65+ '*:files:_files'
66+}
67+
68+__commit() {
69+ _arguments \
70+ '-author="[Author]' \
71+ '-m="[Commit message]' \
72+ '-run="[Config automatically applied when the image is run.\n]'
73+ __docker_containers
74+}
75+
76+__diff() {
77+ __docker_containers
78+}
79+
80+__export() {
81+ __docker_containers
82+}
83+
84+
85+__history() {
86+ __docker_images
87+}
88+
89+__images() {
90+ _arguments \
91+ '-a[show all images]' \
92+ '-notrunc[dont truncate output]' \
93+ '-q[only show numeric IDs]' \
94+ '-viz[output graph in graphviz format]'
95+ __docker_images
96+}
97+
98+__import() {
99+ _arguments '*:files:_files'
100+}
101+
102+__info() {
103+ # no arguments
104+}
105+
106+__insert() {
107+ __docker_images
108+ _arguments '*:files:_files'
109+}
110+
111+__inspect() {
112+ __docker_images
113+ __docker_containers
114+}
115+
116+__kill() {
117+ __docker_containers
118+}
119+
120+__login() {
121+ _arguments \
122+ '-e="[email]' \
123+ '-p="[password]' \
124+ '-u="[username]' \
125+}
126+
127+__logs() {
128+ __docker_containers
129+}
130+