18
18
import picocli .CommandLine .Spec ;
19
19
20
20
import java .io .InputStream ;
21
- import java .io .PrintWriter ;
22
21
import java .io .Writer ;
23
22
import java .nio .file .Files ;
24
23
import java .nio .file .Path ;
25
24
import java .util .concurrent .Callable ;
26
25
27
26
import static io .cucumber .query .NamingStrategy .ExampleName .NUMBER_AND_PICKLE_IF_PARAMETERIZED ;
28
27
29
- @ Command (name = "to-junit-xml" , mixinStandardHelpOptions = true , version = "to-junit-xml 4.0" ,
30
- description = "Converts Cucumber messages to JUnit XML" )
31
- class ToJUnitXml implements Callable <Integer > {
28
+ // TODO: Read version from manifest?
29
+ @ Command (
30
+ name = "junit-xml-formatter" ,
31
+ mixinStandardHelpOptions = true ,
32
+ description = "Converts Cucumber messages to JUnit XML"
33
+ )
34
+ class JunitXmlFormatter implements Callable <Integer > {
32
35
@ Spec
33
36
private CommandSpec spec ;
34
37
@@ -49,6 +52,7 @@ public Integer call() throws Exception {
49
52
50
53
// TODO: Use the CLI options.
51
54
NamingStrategy .ExampleName exampleNameStrategy = NUMBER_AND_PICKLE_IF_PARAMETERIZED ;
55
+ // TODO: Read from standard in, or read/write from files.
52
56
Writer out = spec .commandLine ().getOut ();
53
57
54
58
try (InputStream in = Files .newInputStream (source )) {
@@ -64,10 +68,8 @@ public Integer call() throws Exception {
64
68
return 0 ;
65
69
}
66
70
67
- // this example implements Callable, so parsing, error handling and handling user
68
- // requests for usage help or version help can be done with one line of code.
69
71
public static void main (String ... args ) {
70
- int exitCode = new CommandLine (new ToJUnitXml ()).execute (args );
72
+ int exitCode = new CommandLine (new JunitXmlFormatter ()).execute (args );
71
73
System .exit (exitCode );
72
74
}
73
- }
75
+ }
0 commit comments