-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.mx
37 lines (32 loc) · 1.36 KB
/
docker-compose.mx
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
if { which docker-compose } then {
private autocomplete.docker-compose.services {
open docker-compose.yaml -> [ services ] -> formap k v { out "$k" } -> cast str
}
private autocomplete.docker-compose.FlagValues {
# A helper function to generate autocomplete config for docker-compose
docker-compose: --help -> @[Commands:..]se -> [:0] -> foreach flag {
("$flag": [{
"FlagsDesc": ${ docker-compose --help $flag -> tabulate --map --column-wraps --split-comma --key-inc-hint },
"AllowMultiple": true)
if {
a build,create,events,exec,kill,logs,pause,pull,push,restart,run,scale,start,stop,top,unpause,up -> regexp m/^$flag$/
} then {
(,
"Dynamic": ({ autocomplete.docker-compose.services }))
}
out "\n}],"
}
out ("": [{}])
}
private autocomplete.docker-compose.FlagsDesc {
# Runs docker-compose to query it's command line flags
docker-compose --help -> tabulate: --map --column-wraps --split-comma --key-inc-hint
}
bg {
autocomplete set docker-compose "[{
\"FlagsDesc\": ${ autocomplete.docker-compose.FlagsDesc },
\"FlagValues\": { ${ autocomplete.docker-compose.FlagValues } },
\"ListView\": true
}]"
}
}