Command line: interface --mode STATIC --family ipv4 --mask 255.255.0.0 --gateway 10.77.1.4 --address 10.77.111.179 eth0
Use case: eth0 must be the interface name
Help:
Usage: interface options <interface name>
--address -a /\d{1,3}+.\d{1,3}+.\d{1,3}+.\d{1,3}+/ : interface ip address
--family -f value : ip address family <ipv4, ipv6>
--gateway -g /\d{1,3}+.\d{1,3}+.\d{1,3}+.\d{1,3}+/ : gateway ip address
--mode -m value : modes <STATIC, DHCP, LOOPBACK>
--netmask -n /\d{1,3}+.\d{1,3}+.\d{1,3}+.\d{1,3}+/ : ip address net mask
Java interface:
@CommandLineInterface(application = "interface")
public interface InterfaceCommand {
@Option(shortName = "m", description = "modes <STATIC, DHCP, LOOPBACK>")
InterfaceMode getMode();
@Option(shortName = "f", description = "ip address family <ipv4, ipv6>", defaultValue = "ipv4")
IPAddressFamily getFamily();
@Option(shortName = "n", description = "ip address net mask", pattern = "\\d{1,3}+.\\d{1,3}+.\\d{1,3}+.\\d{1,3}+", defaultValue = "255.255.255.0")
String getNetmask();
@Option(shortName = "g", description = "gateway ip address", pattern = "\\d{1,3}+.\\d{1,3}+.\\d{1,3}+.\\d{1,3}+", defaultValue = "127.0.0.1")
String getGateway();
@Option(shortName = "a", description = "interface ip address", pattern = "\\d{1,3}+.\\d{1,3}+.\\d{1,3}+.\\d{1,3}+", defaultValue = "127.0.0.1")
String getAddress();
//@Option(shortName = "i", description = "interface name")
@Unparsed(name = "<interface name>")
String getInterface();
enum IPAddressFamily {
ipv4, ipv6
}
enum InterfaceMode {
STATIC, DHCP, LOOPBACK
}
}
Error: Option does not take a value: uk.co.flamingpenguin.jewel.cli.UnparsedSpecificationImpl@4b222f
Debugging the code, it seems that argument token eth0 is passed as a value to the option address together with 10.77.111.179