Skip to content
Merged
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
311 changes: 311 additions & 0 deletions command-signatures/json/ip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,311 @@
{
"name": "ip",
"description": "Show and manipulate routing, network devices, interfaces and tunnels",
"subcommands": [
{
"name": "address",
"description": "Protocol (IP or IPv6) address on a device"
},
{
"name": "addrlabel",
"description": "Label configuration for protocol address selection"
},
{
"name": "fou",
"description": "Foo-over-UDP receive port configuration"
},
{
"name": "help",
"description": "Display a list of supported commands and arguments"
},
{
"name": "ila",
"description": "Manage identifier locator addressing (ILA)"
},
{
"name": "ioam",
"description": "Manage in-situ OAM (IOAM)"
},
{
"name": "l2tp",
"description": "Tunnel ethernet over IP (L2TPv3)"
},
{
"name": "link",
"description": "Network device configuration"
},
{
"name": "macsec",
"description": "MACsec device configuration"
},
{
"name": "maddress",
"description": "Multicast address"
},
{
"name": "monitor",
"description": "Watch for netlink messages"
},
{
"name": "mptcp",
"description": "Manage MPTCP path manager"
},
{
"name": "mroute",
"description": "Multicast routing cache entry"
},
{
"name": "mrule",
"description": "Rule in multicast routing policy database"
},
{
"name": "neighbour",
"description": "ARP or NDISC cache entry"
},
{
"name": "netconf",
"description": "Network configuration monitoring"
},
{
"name": "netns",
"description": "Manage network namespaces"
},
{
"name": "nexthop",
"description": "Manage nexthop objects"
},
{
"name": "ntable",
"description": "Manage the neighbor cache's operation"
},
{
"name": "route",
"description": "Routing table entry"
},
{
"name": "rule",
"description": "Rule in routing policy database"
},
{
"name": "sr",
"description": "Manage IPv6 Segment Routing"
},
{
"name": "tap",
"description": "Manage TUN/TAP devices"
},
{
"name": "tcpmetrics",
"description": "Manage TCP metrics"
},
{
"name": "token",
"description": "Manage tokenized interface identifiers"
},
{
"name": "tunnel",
"description": "Tunnel over IP"
},
{
"name": "tuntap",
"description": "Manage TUN/TAP devices"
},
{
"name": "vrf",
"description": "Manage virtual routing and forwarding devices"
},
{
"name": "xfrm",
"description": "Manage IPSec policies"
}
],
"options": [
{
"name": [
"-V",
"-Version"
],
"description": "Display the version of the ip utility"
},
{
"name": [
"-s",
"-statistics",
"-stats"
],
"description": "Output more information (may be used twice for even more)"
},
{
"name": [
"-d",
"-details"
],
"description": "Output more detailed information"
},
{
"name": [
"-r",
"-resolve"
],
"description": "Print DNS names instead of host addresses"
},
{
"name": [
"-h",
"-human-readable",
"-human"
],
"description": "Output statistics with human-readable values"
},
{
"name": "-iec",
"description": "Print human-readable rates in IEC units (e.g. 1Ki = 1024)"
},
{
"name": [
"-j",
"-json"
],
"description": "Output results in JSON format"
},
{
"name": [
"-p",
"-pretty"
],
"description": "Pretty-print JSON output (implies -json)"
},
{
"name": [
"-f",
"-family"
],
"description": "Protocol family to use",
"args": {
"name": "FAMILY",
"suggestions": [
"inet",
"inet6",
"mpls",
"bridge",
"link"
]
}
},
{
"name": "-4",
"description": "Shortcut for -family inet"
},
{
"name": "-6",
"description": "Shortcut for -family inet6"
},
{
"name": "-M",
"description": "Shortcut for -family mpls"
},
{
"name": "-B",
"description": "Shortcut for -family bridge"
},
{
"name": "-0",
"description": "Shortcut for -family link"
},
{
"name": [
"-l",
"-loops"
],
"description": "Maximum number of loops for 'ip address flush'",
"args": {
"name": "COUNT"
}
},
{
"name": [
"-br",
"-brief"
],
"description": "Print only basic information in a tabular format"
},
{
"name": [
"-o",
"-oneline"
],
"description": "Output each record on a single line, replacing line feeds with backslashes"
},
{
"name": [
"-t",
"-timestamp"
],
"description": "Display current time when using monitor"
},
{
"name": [
"-ts",
"-tshort"
],
"description": "Like -timestamp, but use shorter format"
},
{
"name": [
"-b",
"-batch"
],
"description": "Read commands from provided file or standard input",
"args": {
"name": "FILENAME",
"template": "filepaths"
}
},
{
"name": [
"-rc",
"-rcvbuf"
],
"description": "Set the netlink socket receive buffer size (default: 1MB)",
"args": {
"name": "SIZE"
}
},
{
"name": [
"-n",
"-netns"
],
"description": "Switch to the specified network namespace",
"args": {
"name": "NETNS",
"generatorName": "netns"
}
},
{
"name": [
"-N",
"-Numeric"
],
"description": "Print protocol, scope, dsfield, etc. as numbers instead of names"
},
{
"name": [
"-a",
"-all"
],
"description": "Execute specified command over all objects"
},
{
"name": [
"-c",
"-color"
],
"description": "Use color output"
},
{
"name": "-force",
"description": "Don't terminate on errors in batch mode"
}
]
}
25 changes: 25 additions & 0 deletions command-signatures/src/generators/ip.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use warp_completion_metadata::{
CommandBuilder, CommandSignatureGenerators, Generator, GeneratorResultsCollector, Suggestion,
};

pub fn generator() -> CommandSignatureGenerators {
CommandSignatureGenerators::new("ip").add_generator(
"netns",
Generator::script(
CommandBuilder::single_command("ip netns list 2>/dev/null"),
|output| {
output
.lines()
.filter_map(|line| {
// Output format: "name" or "name (id: N)"
let name = line.split_whitespace().next()?;
if name.is_empty() {
return None;
}
Some(Suggestion::with_description(name, "Network namespace"))
})
.collect_unordered_results()
},
),
)
}
2 changes: 2 additions & 0 deletions command-signatures/src/generators/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ mod git;
mod go;
mod gt;
mod heroku;
mod ip;
mod kill;
mod killall;
mod kubecolor;
Expand Down Expand Up @@ -91,6 +92,7 @@ pub fn dynamic_command_signature_data() -> HashMap<String, DynamicCompletionData
gt::generator(),
go::generator(),
heroku::generator(),
ip::generator(),
make::generator(),
man::generator(),
ng::generator(),
Expand Down
Loading