@@ -52,14 +52,16 @@ var (
5252"untag" ,
5353"update" ,
5454}
55+ eventTypes = []string {"config" , "container" , "daemon" , "image" , "network" , "node" , "plugin" , "secret" , "service" , "volume" }
5556)
56- var eventTypes = []string {"config" , "container" , "daemon" , "image" , "network" , "node" , "plugin" , "secret" , "service" , "volume" }
5757
5858func completeFilters (dockerCLI completion.APIClientProvider ) completion.ValidArgsFn {
5959return func (cmd * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
6060if strings .HasPrefix (toComplete , "container=" ) {
61- // the pure container name list should be pulled out from ContainerNames.
6261names , _ := completion .ContainerNames (dockerCLI , true )(cmd , args , toComplete )
62+ if names == nil {
63+ return nil , cobra .ShellCompDirectiveNoFileComp
64+ }
6365return prefixWith ("container=" , names ), cobra .ShellCompDirectiveDefault
6466}
6567if strings .HasPrefix (toComplete , "event=" ) {
@@ -69,8 +71,10 @@ func completeFilters(dockerCLI completion.APIClientProvider) completion.ValidArg
6971return nil , cobra .ShellCompDirectiveNoFileComp
7072}
7173if strings .HasPrefix (toComplete , "network=" ) {
72- // the pure network name list should be pulled out from NetworkNames.
7374names , _ := completion .NetworkNames (dockerCLI )(cmd , args , toComplete )
75+ if names == nil {
76+ return nil , cobra .ShellCompDirectiveNoFileComp
77+ }
7478return prefixWith ("network=" , names ), cobra .ShellCompDirectiveDefault
7579}
7680if strings .HasPrefix (toComplete , "type=" ) {
0 commit comments