From f8cc377447a43116801228a1e3a37836e3550ffa Mon Sep 17 00:00:00 2001 From: rsteube Date: Sun, 27 Feb 2022 16:54:39 +0100 Subject: [PATCH] tmp --- completers/ip_completer/cmd/action/confflag.go | 13 +++++++++++++ completers/ip_completer/cmd/address_add.go | 7 +++++++ 2 files changed, 20 insertions(+) create mode 100644 completers/ip_completer/cmd/action/confflag.go diff --git a/completers/ip_completer/cmd/action/confflag.go b/completers/ip_completer/cmd/action/confflag.go new file mode 100644 index 0000000000..99f73cc353 --- /dev/null +++ b/completers/ip_completer/cmd/action/confflag.go @@ -0,0 +1,13 @@ +package action + +import "github.com/rsteube/carapace" + +func ActionConfFlags() carapace.Action { + return carapace.ActionValuesDescribed( + "home", "(IPv6 only) designates this address the \"home address\"", + "nodad", "(IPv6 only) do not perform Duplicate Address Detection", + "mngtmpaddr", "(IPv6 only) make the kernel manage temporary addresses created from this one as template", + "noprefixroute", "Do not automatically create a route for the network prefix of the added address", + "autojoin", "enable autojoin", + ) +} diff --git a/completers/ip_completer/cmd/address_add.go b/completers/ip_completer/cmd/address_add.go index 85e83aba10..8385ef9648 100644 --- a/completers/ip_completer/cmd/address_add.go +++ b/completers/ip_completer/cmd/address_add.go @@ -2,6 +2,7 @@ package cmd import ( "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/completers/ip_completer/cmd/action" "github.com/rsteube/carapace-bin/pkg/actions/net" "github.com/spf13/cobra" ) @@ -22,4 +23,10 @@ func init() { carapace.ActionValues("dev"), net.ActionDevices(net.IncludedDevices{Wifi: true, Ethernet: true}), ) + + carapace.Gen(address_addCmd).PositionalAnyCompletion( + carapace.ActionCallback(func(c carapace.Context) carapace.Action { + return action.ActionConfFlags().Invoke(c).Filter(c.Args[2:]).ToA() + }), + ) }