Skip to content

Commit

Permalink
lxc/completion: Add network completions to lxc network forward create
Browse files Browse the repository at this point in the history
Signed-off-by: Kadin Sayani <[email protected]>
  • Loading branch information
kadinsayani committed Dec 20, 2024
1 parent 728d524 commit dd2d915
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lxc/network_forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,14 @@ lxc network forward create n1 127.0.0.1 < config.yaml
cmd.Flags().StringVar(&c.networkForward.flagTarget, "target", "", i18n.G("Cluster member name")+"``")
cmd.Flags().StringVar(&c.flagAllocate, "allocate", "", i18n.G("Auto-allocate an IPv4 or IPv6 listen address. One of 'ipv4', 'ipv6'.")+"``")

cmd.ValidArgsFunction = func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if len(args) == 0 {
return c.global.cmpNetworks(toComplete)
}

return nil, cobra.ShellCompDirectiveNoFileComp
}

return cmd
}

Expand Down

0 comments on commit dd2d915

Please sign in to comment.