4
4
import java .util .List ;
5
5
6
6
import com .beust .jcommander .Parameter ;
7
+ import com .google .common .base .Function ;
7
8
8
9
import io .github .bensku .tsbind .AstConsumer ;
9
10
import io .github .bensku .tsbind .JsonEmitter ;
12
13
public class Args {
13
14
14
15
public enum OutputFormat {
15
- JSON (new JsonEmitter ()),
16
- TS_TYPES (new BindingGenerator ());
16
+ JSON (( args ) -> new JsonEmitter ()),
17
+ TS_TYPES (( args ) -> new BindingGenerator (args . index ));
17
18
18
- public final AstConsumer <String > consumer ;
19
+ public final Function < Args , AstConsumer <String >> consumerSource ;
19
20
20
- OutputFormat (AstConsumer <String > consumer ) {
21
- this .consumer = consumer ;
21
+ OutputFormat (Function < Args , AstConsumer <String > > consumer ) {
22
+ this .consumerSource = consumer ;
22
23
}
23
24
}
24
25
25
26
@ Parameter (names = "--format" )
26
27
public OutputFormat format = OutputFormat .TS_TYPES ;
27
28
28
29
@ Parameter (names = "--in" )
29
- public Path inputPath ;
30
+ public Path in ;
30
31
31
32
@ Parameter (names = "--symbols" )
32
33
public List <Path > symbols = List .of ();
@@ -50,8 +51,11 @@ public enum OutputFormat {
50
51
public List <String > blacklist = List .of ();
51
52
52
53
@ Parameter (names = "--out" )
53
- public Path outDir = Path .of ("" );
54
+ public Path out = Path .of ("" );
54
55
55
56
@ Parameter (names = "--packageJson" )
56
57
public Path packageJson ;
58
+
59
+ @ Parameter (names = "--index" )
60
+ public boolean index ;
57
61
}
0 commit comments