@@ -28,26 +28,26 @@ Options:
2828 * @returns output Diff output from git.
2929 */
3030function runGitDiff ( useCached : boolean ) : string {
31- const flags : string [ ] = [
32- "diff-index" ,
33- "--name-status" ,
34- "--find-renames" ,
35- "--find-copies" ,
36- "--no-color" ,
37- ] ;
31+ const flags : string [ ] = [
32+ "diff-index" ,
33+ "--name-status" ,
34+ "--find-renames" ,
35+ "--find-copies" ,
36+ "--no-color" ,
37+ ] ;
3838
39- if ( useCached ) {
40- flags . push ( "--cached" ) ;
41- }
39+ if ( useCached ) {
40+ flags . push ( "--cached" ) ;
41+ }
4242
43- flags . push ( "HEAD" ) ;
43+ flags . push ( "HEAD" ) ;
4444
45- const output : string = execFileSync ( "git" , flags , {
46- encoding : "utf8" ,
47- stdio : [ "ignore" , "pipe" , "pipe" ] ,
48- } ) ;
45+ const output : string = execFileSync ( "git" , flags , {
46+ encoding : "utf8" ,
47+ stdio : [ "ignore" , "pipe" , "pipe" ] ,
48+ } ) ;
4949
50- return output . trim ( ) ;
50+ return output . trim ( ) ;
5151}
5252
5353/**
@@ -57,13 +57,13 @@ function runGitDiff(useCached: boolean): string {
5757 * @returns Generated commit message text.
5858 */
5959export function generateCommitMessage ( useCached : boolean ) : string {
60- const diffOutput : string = runGitDiff ( useCached ) ;
61- if ( ! diffOutput ) {
62- throw new Error ( "No file changes found" ) ;
63- }
60+ const diffOutput : string = runGitDiff ( useCached ) ;
61+ if ( ! diffOutput ) {
62+ throw new Error ( "No file changes found" ) ;
63+ }
6464
65- const lines : string [ ] = diffOutput . split ( "\n" ) ;
66- return generateMsg ( lines ) ;
65+ const lines : string [ ] = diffOutput . split ( "\n" ) ;
66+ return generateMsg ( lines ) ;
6767}
6868
6969/**
@@ -73,15 +73,15 @@ export function generateCommitMessage(useCached: boolean): string {
7373 * Prints the generated commit message to stdout.
7474 */
7575function main ( argv : string [ ] ) : void {
76- if ( shouldShowHelp ( argv ) ) {
77- console . log ( HELP_TEXT ) ;
78- return ;
79- }
80- const useCached : boolean = argv . includes ( "--cached" ) ;
81- const msg : string = generateCommitMessage ( useCached ) ;
82- console . log ( msg ) ;
76+ if ( shouldShowHelp ( argv ) ) {
77+ console . log ( HELP_TEXT ) ;
78+ return ;
79+ }
80+ const useCached : boolean = argv . includes ( "--cached" ) ;
81+ const msg : string = generateCommitMessage ( useCached ) ;
82+ console . log ( msg ) ;
8383}
8484
8585if ( require . main === module ) {
86- main ( process . argv . slice ( 2 ) ) ;
86+ main ( process . argv . slice ( 2 ) ) ;
8787}
0 commit comments