File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,12 @@ use std::fs::File;
4
4
use std:: io:: Write as IoWrite ;
5
5
use std:: path:: PathBuf ;
6
6
7
+ #[ allow( too_many_arguments) ]
7
8
pub fn generate_code (
8
9
query_path : PathBuf ,
9
10
schema_path : PathBuf ,
10
- selected_operation : String ,
11
+ module_name : String ,
12
+ selected_operation : Option < String > ,
11
13
additional_derives : Option < String > ,
12
14
deprecation_strategy : & Option < String > ,
13
15
no_formatting : bool ,
@@ -22,7 +24,9 @@ pub fn generate_code(
22
24
} ;
23
25
24
26
let options = GraphQLClientDeriveOptions {
25
- struct_name : selected_operation,
27
+ operation_name : selected_operation,
28
+ struct_name : None ,
29
+ module_name : Some ( module_name) ,
26
30
additional_derives,
27
31
deprecation_strategy,
28
32
} ;
Original file line number Diff line number Diff line change @@ -42,8 +42,11 @@ enum Cli {
42
42
/// Path to graphql schema file.
43
43
#[ structopt( parse( from_os_str) ) ]
44
44
schema_path : PathBuf ,
45
- /// Name of struct that is implementation target.
46
- selected_operation : String ,
45
+ /// Name of module.
46
+ module_name : String ,
47
+ /// Name of target query. If you don't set this parameter, cli generate all queries in query file.
48
+ #[ structopt( short = "o" , long = "selected-operation" ) ]
49
+ selected_operation : Option < String > ,
47
50
/// Additional derives that will be added to the generated structs and enums for the response and the variables.
48
51
/// --additional-derives='Serialize,PartialEq'
49
52
#[ structopt( short = "a" , long = "additional-derives" ) ]
@@ -73,6 +76,7 @@ fn main() -> Result<(), failure::Error> {
73
76
Cli :: Generate {
74
77
query_path,
75
78
schema_path,
79
+ module_name,
76
80
selected_operation,
77
81
additional_derives,
78
82
deprecation_strategy,
@@ -81,6 +85,7 @@ fn main() -> Result<(), failure::Error> {
81
85
} => generate:: generate_code (
82
86
query_path,
83
87
schema_path,
88
+ module_name,
84
89
selected_operation,
85
90
additional_derives,
86
91
& deprecation_strategy,
You can’t perform that action at this time.
0 commit comments