@@ -6,8 +6,9 @@ use jrsonnet_evaluator::{
6
6
IStr ,
7
7
} ;
8
8
use jrsonnet_parser:: { ParserSettings , Source } ;
9
+ use std:: path:: PathBuf ;
9
10
10
- use crate :: { ExtFile , ExtStr } ;
11
+ use crate :: ExtStr ;
11
12
12
13
#[ derive( Parser ) ]
13
14
#[ clap( next_help_heading = "TOP LEVEL ARGUMENTS" ) ]
@@ -21,33 +22,23 @@ pub struct TlaOpts {
21
22
/// Read top level argument string from file.
22
23
/// See also `--tla-str`
23
24
#[ clap( long, name = "name=tla path" , number_of_values = 1 ) ]
24
- tla_str_file : Vec < ExtFile > ,
25
+ tla_str_file : Vec < PathBuf > ,
25
26
/// Add top level argument from code.
26
27
/// See also `--tla-str`
27
28
#[ clap( long, name = "name[=tla source]" , number_of_values = 1 ) ]
28
29
tla_code : Vec < ExtStr > ,
29
30
/// Read top level argument code from file.
30
31
/// See also `--tla-str`
31
32
#[ clap( long, name = "name=tla code path" , number_of_values = 1 ) ]
32
- tla_code_file : Vec < ExtFile > ,
33
+ tla_code_file : Vec < PathBuf > ,
33
34
}
34
35
impl TlaOpts {
35
- pub fn tla_opts ( & self ) -> Result < GcHashMap < IStr , TlaArg > > {
36
+ pub fn tla_opts ( & self ) -> Result < ( GcHashMap < IStr , TlaArg > , & Vec < PathBuf > , & Vec < PathBuf > ) > {
36
37
let mut out = GcHashMap :: new ( ) ;
37
- for ( name, value) in self
38
- . tla_str
39
- . iter ( )
40
- . map ( |c| ( & c. name , & c. value ) )
41
- . chain ( self . tla_str_file . iter ( ) . map ( |c| ( & c. name , & c. value ) ) )
42
- {
38
+ for ( name, value) in self . tla_str . iter ( ) . map ( |c| ( & c. name , & c. value ) ) {
43
39
out. insert ( name. into ( ) , TlaArg :: String ( value. into ( ) ) ) ;
44
40
}
45
- for ( name, code) in self
46
- . tla_code
47
- . iter ( )
48
- . map ( |c| ( & c. name , & c. value ) )
49
- . chain ( self . tla_code_file . iter ( ) . map ( |c| ( & c. name , & c. value ) ) )
50
- {
41
+ for ( name, code) in self . tla_code . iter ( ) . map ( |c| ( & c. name , & c. value ) ) {
51
42
let source = Source :: new_virtual ( format ! ( "<top-level-arg:{name}>" ) . into ( ) , code. into ( ) ) ;
52
43
out. insert (
53
44
( name as & str ) . into ( ) ,
@@ -65,6 +56,6 @@ impl TlaOpts {
65
56
) ,
66
57
) ;
67
58
}
68
- Ok ( out)
59
+ Ok ( ( out, & self . tla_str_file , & self . tla_code_file ) )
69
60
}
70
61
}
0 commit comments