22
33import * as p from "@clack/prompts" ;
44import color from "picocolors" ;
5- import { execSync } from "child_process" ;
5+ import { StdioOptions , execSync } from "child_process" ;
66import { chdir } from "process" ;
77import { Output , parse } from "valibot" ;
88import { CommitState , Config } from "./valibot-state" ;
@@ -285,8 +285,8 @@ export async function main(config: Output<typeof Config>) {
285285
286286 if ( config . confirm_with_editor ) {
287287 const options = config . overrides . shell
288- ? { shell : config . overrides . shell , stdio : "inherit" }
289- : { stdio : "inherit" } ;
288+ ? { shell : config . overrides . shell , stdio : "inherit" as StdioOptions }
289+ : { stdio : "inherit" as StdioOptions } ;
290290 const trailer = commit_state . trailer
291291 ? `--trailer="${ commit_state . trailer } "`
292292 : "" ;
@@ -298,10 +298,12 @@ export async function main(config: Output<typeof Config>) {
298298 }
299299
300300 let continue_commit = true ;
301- p . note (
302- build_commit_string ( commit_state , config , true , false , true ) ,
303- "Commit Preview" ,
304- ) ;
301+ if ( config . print_commit_output ) {
302+ p . note (
303+ build_commit_string ( commit_state , config , true , false , true ) ,
304+ "Commit Preview" ,
305+ ) ;
306+ }
305307 if ( config . confirm_commit ) {
306308 continue_commit = ( await p . confirm ( {
307309 message : "Confirm Commit?" ,
@@ -315,22 +317,21 @@ export async function main(config: Output<typeof Config>) {
315317 }
316318
317319 try {
320+ p . log . info ( "Committing changes..." ) ;
318321 const options = config . overrides . shell
319- ? { shell : config . overrides . shell }
320- : { } ;
322+ ? { shell : config . overrides . shell , stdio : "inherit" as StdioOptions }
323+ : { stdio : "inherit" as StdioOptions } ;
321324 const trailer = commit_state . trailer
322325 ? `--trailer="${ commit_state . trailer } "`
323326 : "" ;
324- const output = execSync (
327+ execSync (
325328 `git ${ flags . git_args } commit -m "${ build_commit_string ( commit_state , config , false , true , false ) } " ${ trailer } ` ,
326329 options ,
327- )
328- . toString ( )
329- . trim ( ) ;
330- if ( config . print_commit_output ) p . log . info ( output ) ;
330+ ) ;
331331 } catch ( err ) {
332332 p . log . error ( "Something went wrong when committing: " + err ) ;
333333 }
334+ p . log . success ( "Commit Complete" ) ;
334335}
335336
336337function build_commit_string (
0 commit comments