@@ -30,6 +30,11 @@ async fn main() {
30
30
dotenv:: dotenv ( ) . ok ( ) ;
31
31
32
32
let args = std:: env:: args ( ) . collect :: < Vec < String > > ( ) [ 1 ..] . to_vec ( ) ;
33
+ let files = args
34
+ . iter ( )
35
+ . filter ( |arg| !arg. starts_with ( "-" ) )
36
+ . map ( |arg| arg. to_owned ( ) )
37
+ . collect :: < Vec < String > > ( ) ;
33
38
34
39
if args. contains ( & "--help" . to_owned ( ) ) || args. contains ( & "-h" . to_owned ( ) ) {
35
40
let usage_str = format ! (
@@ -235,7 +240,12 @@ async fn main() {
235
240
Err ( err) => return println ! ( "{} {}" , "Error:" . red( ) , err) ,
236
241
}
237
242
238
- run ( & args, "Created README.md" . to_owned ( ) , push, & git) ;
243
+ run (
244
+ & vec ! [ "README.md" . to_owned( ) ] ,
245
+ "Created README.md" . to_owned ( ) ,
246
+ push,
247
+ & git,
248
+ ) ;
239
249
std:: process:: exit ( 0 ) ;
240
250
}
241
251
@@ -259,11 +269,11 @@ async fn main() {
259
269
}
260
270
} ;
261
271
262
- run ( & args , result, push, & git) ;
272
+ run ( & files , result, push, & git) ;
263
273
}
264
274
265
- fn run ( args : & Vec < String > , result : String , push : bool , git : & Git ) {
266
- let command = build_commands ( & result, push, & args ) ;
275
+ fn run ( files : & Vec < String > , result : String , push : bool , git : & Git ) {
276
+ let command = build_commands ( & result, push, & files ) ;
267
277
268
278
let parsed_command = parse_commands ( & command, true ) ;
269
279
@@ -278,7 +288,7 @@ fn run(args: &Vec<String>, result: String, push: bool, git: &Git) {
278
288
std:: io:: stdin ( ) . read_line ( & mut input) . unwrap ( ) ;
279
289
println ! ( "" ) ;
280
290
if input. trim ( ) == "y" || input. trim ( ) == "Y" || input. trim ( ) == "" {
281
- git. add_old ( Some ( & args ) ) ;
291
+ git. add_old ( Some ( & files ) ) ;
282
292
git. commit_old ( & result) ;
283
293
284
294
if push {
@@ -299,7 +309,7 @@ fn run(args: &Vec<String>, result: String, push: bool, git: &Git) {
299
309
300
310
match prompt {
301
311
"Run" => {
302
- git. add_old ( Some ( & args ) ) ;
312
+ git. add_old ( Some ( & files ) ) ;
303
313
git. commit_old ( & result) ;
304
314
305
315
if push {
@@ -311,7 +321,7 @@ fn run(args: &Vec<String>, result: String, push: bool, git: &Git) {
311
321
}
312
322
"Edit" => {
313
323
let result = edit ( result) ;
314
- run ( & args , result, push, git) ;
324
+ run ( & files , result, push, git) ;
315
325
}
316
326
"Abort" => {
317
327
println ! ( "{}" , "Aborted" . red( ) ) ;
0 commit comments