aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/completions
diff options
context:
space:
mode:
authorGravatar David Flores <dmousex@gmail.com>2014-04-18 18:13:10 -0500
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-04-19 14:50:15 -0700
commit2bbb59964fadff0f87989ec3f1f32a7c2dac9a05 (patch)
tree568fa72e1b65be09cfaaffacfb1da71d19195e01 /share/completions
parent4fd32eb48e1ab6cb03f5e661cf78045186f82354 (diff)
functions on top
Diffstat (limited to 'share/completions')
-rw-r--r--share/completions/docker.fish50
1 files changed, 27 insertions, 23 deletions
diff --git a/share/completions/docker.fish b/share/completions/docker.fish
index 31b83f9a..589e79c4 100644
--- a/share/completions/docker.fish
+++ b/share/completions/docker.fish
@@ -2,6 +2,33 @@
# Completions for the docker command
#
+#
+# Functions
+#
+
+function __fish_docker_using_command
+ set cmd (commandline -opc)
+ if [ (count $cmd) -gt 1 ]
+ if [ $argv[1] = $cmd[2] ]
+ return 0
+ end
+ end
+ return 1
+end
+
+function __fish_docker_all_containers --description "Show all containers"
+ command docker ps -q -a
+end
+
+
+function __fish_docker_start_containers --description "Show the running containers"
+ command docker ps -q
+end
+
+function __fish_docker_stop_containers --description "Show the exited containers"
+ command docker ps -a | grep "Exit" | awk '{ print $1 }'
+end
+
# All docker commands
complete -c docker -n '__fish_use_subcommand' -xa attach --description "Attach to a running container"
complete -c docker -n '__fish_use_subcommand' -xa build --description "Build a container from a Dockerfile"
@@ -37,29 +64,6 @@ complete -c docker -n '__fish_use_subcommand' -xa top --description "Lookup the
complete -c docker -n '__fish_use_subcommand' -xa version --description "Show the docker version information"
complete -c docker -n '__fish_use_subcommand' -xa wait --description "Block until a container stops, then print its exit code"
-function __fish_docker_using_command
- set cmd (commandline -opc)
- if [ (count $cmd) -gt 1 ]
- if [ $argv[1] = $cmd[2] ]
- return 0
- end
- end
- return 1
-end
-
-function __fish_docker_all_containers --description "Show all containers"
- command docker ps -q -a
-end
-
-
-function __fish_docker_start_containers --description "Show the running containers"
- command docker ps -q
-end
-
-function __fish_docker_stop_containers --description "Show the exited containers"
- command docker ps -a | grep "Exit" | awk '{ print $1 }'
-end
-
#
# docker ps
#