public class GetOpts extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
arg
Demo code
|
String |
optarg
current optional argument
|
String |
opterr |
int |
optind
next option to process
|
String |
optopt |
| Constructor and Description |
|---|
GetOpts(String[] args,
LongOpt... options)
create a new class to process cmd line arguments
Sample code:
getopt test = new getopts(args, |
GetOpts(String[] args,
String optString)
create a command-line parser for the 'old' short options
getopts options = new getopts(args,"abc:d:E");
|
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args) |
char |
nextOption() |
int |
optarg()
for convenience: try to parse optarg into an integer
|
void |
printHelp(PrintStream out) |
public int optind
public String optarg
public String opterr
public String optopt
public static String arg
public GetOpts(String[] args, LongOpt... options)
getopt test = new getopts(args,
new LongOpt('a',"arg",true);
new LongOpt('b',"beg",false);
new LongOpt('c',null,false));args - options - public char nextOption()
public int optarg()
public static void main(String[] args)
public void printHelp(PrintStream out)
Copyright © 2025. All rights reserved.