1 |
|
package net.technearts.rip; |
2 |
|
|
3 |
|
import static net.technearts.rip.RipServer.localhost; |
4 |
|
|
5 |
|
import org.apache.commons.cli.CommandLine; |
6 |
|
import org.apache.commons.cli.CommandLineParser; |
7 |
|
import org.apache.commons.cli.DefaultParser; |
8 |
|
import org.apache.commons.cli.Option; |
9 |
|
import org.apache.commons.cli.Options; |
10 |
|
import org.apache.commons.cli.ParseException; |
11 |
|
import org.slf4j.Logger; |
12 |
|
import org.slf4j.LoggerFactory; |
13 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.3 |
|
14 |
|
public class Cli { |
15 |
|
private static final Logger logger = LoggerFactory.getLogger(Cli.class); |
16 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.29 |
|
17 |
0 |
private static CommandLine commandLine(final String... args)... |
18 |
|
throws ParseException { |
19 |
0 |
final CommandLineParser parser = new DefaultParser(); |
20 |
0 |
final Options options = new Options(); |
21 |
0 |
options.addOption(Option.builder("w").longOpt("workDir") |
22 |
|
.desc("Working Directory").hasArg().build()); |
23 |
0 |
try { |
24 |
0 |
return parser.parse(options, args); |
25 |
|
} catch (final ParseException ex) { |
26 |
0 |
logger.error(ex.getMessage()); |
27 |
0 |
throw ex; |
28 |
|
} |
29 |
|
} |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
@param |
34 |
|
@throws |
35 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
36 |
0 |
public static void main(final String[] args) throws ParseException {... |
37 |
0 |
final CommandLine line = commandLine(args); |
38 |
0 |
final String workDir = line.getOptionValue("w", "/"); |
39 |
0 |
localhost(7777, workDir); |
40 |
|
|
41 |
|
} |
42 |
|
} |