File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ Options:
27
27
--update, -u: Updates the program to the latest version.
28
28
--force-update, -f: Forces the update to the latest version.
29
29
--init, -i: Initializes a README.md file in the current directory based on the content of the given files.
30
+ --no-ai, -n: Commits the changes without using GPT-3.
30
31
--push, -p: Pushes the changes to the remote repository after running the commands.
31
32
--api-key: Sets the API key to use for GPT-3. You can also set the API key in the .env file.
32
33
--clear-api-key: Clears the API key from the config file.
Original file line number Diff line number Diff line change @@ -63,6 +63,11 @@ async fn main() {
63
63
"--init, -i [files]:" . magenta( ) ,
64
64
"Initializes a README.md file in the current directory based on the content of the given files"
65
65
) ;
66
+ println ! (
67
+ "{} {}" ,
68
+ "--no-ai, -n:" . magenta( ) ,
69
+ "Commits the changes without using GPT-3"
70
+ ) ;
66
71
println ! (
67
72
"{} {}" ,
68
73
"--push, -p:" . magenta( ) ,
@@ -234,6 +239,12 @@ async fn main() {
234
239
std:: process:: exit ( 0 ) ;
235
240
}
236
241
242
+ if args. contains ( & "--no-ai" . to_owned ( ) ) || args. contains ( & "-n" . to_owned ( ) ) {
243
+ let result = vec ! [ "#Title" , "##Body" ] . join ( "\n " ) ;
244
+ run ( & args, result, push, & git) ;
245
+ return ;
246
+ }
247
+
237
248
let loader = utils:: Loader :: new ( "Waiting for response from GPT-3" ) ;
238
249
239
250
let result = query ( None , & git, args. clone ( ) ) . await ;
@@ -367,5 +378,10 @@ fn edit(result: String) -> String {
367
378
368
379
lines[ index] = prompt. as_str ( ) ;
369
380
370
- lines. join ( "\n " )
381
+ lines
382
+ . iter ( )
383
+ . filter ( |line| !line. is_empty ( ) )
384
+ . map ( |line| line. to_owned ( ) )
385
+ . collect :: < Vec < & str > > ( )
386
+ . join ( "\n " )
371
387
}
You can’t perform that action at this time.
0 commit comments