Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added ip #897

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
)
}
46 changes: 46 additions & 0 deletions completers/ip_completer/cmd/action/type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package action

import "github.com/rsteube/carapace"

func ActionTypes() carapace.Action {
return carapace.ActionValues(
"amt",
"bareudp",
"bond",
"bond_slave",
"bridge",
"bridge_slave",
"dummy",
"erspan",
"geneve",
"gre",
"gretap",
"ifb",
"ip6erspan",
"ip6gre",
"ip6gretap",
"ip6tnl",
"ipip",
"ipoib",
"ipvlan",
"ipvtap",
"macsec",
"macvlan",
"macvtap",
"netdevsim",
"nlmon",
"rmnet",
"sit",
"team",
"team_slave",
"vcan",
"veth",
"vlan",
"vrf",
"vti",
"vxcan",
"vxlan",
"wwan",
"xfrm",
)
}
18 changes: 18 additions & 0 deletions completers/ip_completer/cmd/addlabel.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var addrlabelCmd = &cobra.Command{
Use: "addrlabel",
Short: "label configuration for protocol address selection",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(addrlabelCmd).Standalone()

rootCmd.AddCommand(addrlabelCmd)
}
18 changes: 18 additions & 0 deletions completers/ip_completer/cmd/address.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var addressCmd = &cobra.Command{
Use: "address",
Short: "protocol (IP or IPv6) address on a device",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(addressCmd).Standalone()

rootCmd.AddCommand(addressCmd)
}
32 changes: 32 additions & 0 deletions completers/ip_completer/cmd/address_add.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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"
)

var address_addCmd = &cobra.Command{
Use: "add",
Short: "add new protocol address",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(address_addCmd).Standalone()

addressCmd.AddCommand(address_addCmd)

carapace.Gen(address_addCmd).PositionalCompletion(
net.ActionIpv4Addresses(), // TODO ip6
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()
}),
)
}
18 changes: 18 additions & 0 deletions completers/ip_completer/cmd/address_restore.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var address_restoreCmd = &cobra.Command{
Use: "restore",
Short: "",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(address_restoreCmd).Standalone()

addressCmd.AddCommand(address_restoreCmd)
}
18 changes: 18 additions & 0 deletions completers/ip_completer/cmd/address_showdump.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var address_showdumpCmd = &cobra.Command{
Use: "showdump",
Short: "",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(address_showdumpCmd).Standalone()

addressCmd.AddCommand(address_showdumpCmd)
}
18 changes: 18 additions & 0 deletions completers/ip_completer/cmd/ioam.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var ioamCmd = &cobra.Command{
Use: "ioam",
Short: "manage IOAM namespaces and IOAM schemas",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(ioamCmd).Standalone()

rootCmd.AddCommand(ioamCmd)
}
18 changes: 18 additions & 0 deletions completers/ip_completer/cmd/l2tp.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var l2tpCmd = &cobra.Command{
Use: "l2tp",
Short: "tunnel ethernet over IP (L2TPv3)",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(l2tpCmd).Standalone()

rootCmd.AddCommand(l2tpCmd)
}
18 changes: 18 additions & 0 deletions completers/ip_completer/cmd/link.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var linkCmd = &cobra.Command{
Use: "link",
Short: "network device",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(linkCmd).Standalone()

rootCmd.AddCommand(linkCmd)
}
18 changes: 18 additions & 0 deletions completers/ip_completer/cmd/maddress.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var maddressCmd = &cobra.Command{
Use: "maddress",
Short: "multicast address",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(maddressCmd).Standalone()

rootCmd.AddCommand(maddressCmd)
}
18 changes: 18 additions & 0 deletions completers/ip_completer/cmd/monitor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var monitorCmd = &cobra.Command{
Use: "monitor",
Short: "watch for netlink messages",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(monitorCmd).Standalone()

rootCmd.AddCommand(monitorCmd)
}
18 changes: 18 additions & 0 deletions completers/ip_completer/cmd/mptcp.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var mptcpCmd = &cobra.Command{
Use: "mptcp",
Short: "manage MPTCP path manager",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(mptcpCmd).Standalone()

rootCmd.AddCommand(mptcpCmd)
}
18 changes: 18 additions & 0 deletions completers/ip_completer/cmd/mroute.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var mrouteCmd = &cobra.Command{
Use: "mroute",
Short: "multicast routing cache entry",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(mrouteCmd).Standalone()

rootCmd.AddCommand(mrouteCmd)
}
18 changes: 18 additions & 0 deletions completers/ip_completer/cmd/mrule.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var mruleCmd = &cobra.Command{
Use: "mrule",
Short: "rule in multicast routing policy database",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(mruleCmd).Standalone()

rootCmd.AddCommand(mruleCmd)
}
18 changes: 18 additions & 0 deletions completers/ip_completer/cmd/neighbour.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var neighbourCmd = &cobra.Command{
Use: "neighbour",
Short: "manage ARP or NDISC cache entries",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(neighbourCmd).Standalone()

rootCmd.AddCommand(neighbourCmd)
}
18 changes: 18 additions & 0 deletions completers/ip_completer/cmd/netns.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var netnsCmd = &cobra.Command{
Use: "netns",
Short: "manage network namespaces",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(netnsCmd).Standalone()

rootCmd.AddCommand(netnsCmd)
}
18 changes: 18 additions & 0 deletions completers/ip_completer/cmd/ntable.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var ntableCmd = &cobra.Command{
Use: "ntable",
Short: "manage the neighbor cache's operation",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(ntableCmd).Standalone()

rootCmd.AddCommand(ntableCmd)
}
Loading