mirror of
https://github.com/containers/podman.git
synced 2025-06-27 13:38:49 +08:00
Merge pull request #16555 from Luap99/network-driver-completion
shell completion: fix hard coded network drivers
This commit is contained in:
@ -1409,10 +1409,18 @@ func AutocompleteManifestFormat(cmd *cobra.Command, args []string, toComplete st
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AutocompleteNetworkDriver - Autocomplete network driver option.
|
// AutocompleteNetworkDriver - Autocomplete network driver option.
|
||||||
// -> "bridge", "macvlan"
|
|
||||||
func AutocompleteNetworkDriver(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
func AutocompleteNetworkDriver(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||||
drivers := []string{types.BridgeNetworkDriver, types.MacVLANNetworkDriver, types.IPVLANNetworkDriver}
|
engine, err := setupContainerEngine(cmd)
|
||||||
return drivers, cobra.ShellCompDirectiveNoFileComp
|
if err != nil {
|
||||||
|
cobra.CompErrorln(err.Error())
|
||||||
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
|
}
|
||||||
|
info, err := engine.Info(registry.Context())
|
||||||
|
if err != nil {
|
||||||
|
cobra.CompErrorln(err.Error())
|
||||||
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
|
}
|
||||||
|
return info.Plugins.Network, cobra.ShellCompDirectiveNoFileComp
|
||||||
}
|
}
|
||||||
|
|
||||||
// AutocompleteNetworkIPAMDriver - Autocomplete network ipam driver option.
|
// AutocompleteNetworkIPAMDriver - Autocomplete network ipam driver option.
|
||||||
|
Reference in New Issue
Block a user