File tree Expand file tree Collapse file tree 4 files changed +17
-11
lines changed
Expand file tree Collapse file tree 4 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 88* [ ] [ Feature] File watcher for zipped epw (and epw??) files
99* [ ] [ Feature] Auto unzip folder and copy lib to libs folder
1010* [ ] [ Code] New struct for CLI-only options
11- * [ ] [ Feature] When using ` -g ` , treat input as output path
11+ * [x ] [ Feature] When using ` -g ` , treat input as output path
Original file line number Diff line number Diff line change 5252 takes_value : false
5353 multiple : false
5454 conflicts_with :
55- - input
5655 - id
5756 - config
5857 - watch
Original file line number Diff line number Diff line change @@ -184,18 +184,25 @@ impl Config {
184184
185185 }
186186
187- pub fn generate ( ) -> LLResult < ( ) > {
187+ pub fn generate ( input : & String ) -> LLResult < String > {
188188
189- let path = PathBuf :: from ( LL_CONFIG ) ;
189+ // let path = PathBuf::from(LL_CONFIG);
190+ let path = PathBuf :: from ( match input. trim ( ) . is_empty ( ) {
191+ true => LL_CONFIG ,
192+ false => input
193+ } ) ;
190194
191- if path. exists ( ) {
195+ if path. clone ( ) . exists ( ) {
192196
193- return Err ( LLError :: new ( format ! ( "{} already exists" , LL_CONFIG ) ) )
197+ return Err ( LLError :: new ( format ! ( "{} already exists" , path . to_str ( ) . unwrap ( ) ) ) )
194198
195199 }
196200
197- match fs:: write ( path, include_str ! ( "../LibraryLoader.example.toml" ) ) {
198- Ok ( v) => Ok ( v) ,
201+ match fs:: write ( & path, include_str ! ( "../LibraryLoader.example.toml" ) ) {
202+ Ok ( _) => {
203+ let path_as_string = String :: from ( path. to_str ( ) . unwrap ( ) ) ;
204+ Ok ( path_as_string)
205+ } ,
199206 Err ( e) => Err ( LLError :: new ( format ! ( "{}" , e) ) )
200207 }
201208
Original file line number Diff line number Diff line change @@ -34,10 +34,10 @@ fn real_main() -> LLResult<()> {
3434
3535 if conf. generate_config {
3636
37- return match Config :: generate ( ) {
37+ return match Config :: generate ( & conf . input ) {
3838 Ok ( v) => {
39- println ! ( "Generated {}" , consts :: LL_CONFIG ) ;
40- Ok ( v )
39+ println ! ( "Generated {}" , v ) ;
40+ Ok ( ( ) )
4141 } ,
4242 Err ( e) => Err ( e)
4343 }
You can’t perform that action at this time.
0 commit comments