Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Apr 17, 2023
1 parent c88e24c commit f8cc377
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions completers/ip_completer/cmd/action/confflag.go
Original file line number Diff line number Diff line change
@@ -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",
)
}
7 changes: 7 additions & 0 deletions completers/ip_completer/cmd/address_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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()
}),
)
}

0 comments on commit f8cc377

Please sign in to comment.