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;
44use std:: io:: Write as IoWrite ;
55use std:: path:: PathBuf ;
66
7+ #[ allow( too_many_arguments) ]
78pub fn generate_code (
89 query_path : PathBuf ,
910 schema_path : PathBuf ,
10- selected_operation : String ,
11+ module_name : String ,
12+ selected_operation : Option < String > ,
1113 additional_derives : Option < String > ,
1214 deprecation_strategy : & Option < String > ,
1315 no_formatting : bool ,
@@ -22,7 +24,9 @@ pub fn generate_code(
2224 } ;
2325
2426 let options = GraphQLClientDeriveOptions {
25- struct_name : selected_operation,
27+ operation_name : selected_operation,
28+ struct_name : None ,
29+ module_name : Some ( module_name) ,
2630 additional_derives,
2731 deprecation_strategy,
2832 } ;
Original file line number Diff line number Diff line change @@ -42,8 +42,11 @@ enum Cli {
4242 /// Path to graphql schema file.
4343 #[ structopt( parse( from_os_str) ) ]
4444 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 > ,
4750 /// Additional derives that will be added to the generated structs and enums for the response and the variables.
4851 /// --additional-derives='Serialize,PartialEq'
4952 #[ structopt( short = "a" , long = "additional-derives" ) ]
@@ -73,6 +76,7 @@ fn main() -> Result<(), failure::Error> {
7376 Cli :: Generate {
7477 query_path,
7578 schema_path,
79+ module_name,
7680 selected_operation,
7781 additional_derives,
7882 deprecation_strategy,
@@ -81,6 +85,7 @@ fn main() -> Result<(), failure::Error> {
8185 } => generate:: generate_code (
8286 query_path,
8387 schema_path,
88+ module_name,
8489 selected_operation,
8590 additional_derives,
8691 & deprecation_strategy,
You can’t perform that action at this time.
0 commit comments