@@ -72,37 +72,35 @@ const customHelp = (program, templateFilePath, definitionsFilePath) => {
7272//
7373// Main
7474//
75- try {
76- program
77- . option ( '-d, --duet' , 'run git-duet mode' )
78- . option ( '-D, --dry-run' , 'run dry-run mode' )
79- . option ( '-i, --interactive' , 'run interactive mode' )
80- . option ( '-S, --silent' , "don't show commit command" )
81- . option ( '-t, --typo-check' , '[Already deleted this function] check spell' )
82- . option ( '--gen-config' , 'generate config files' )
83- . version ( version )
84-
85- if ( process . argv . includes ( '--gen-config' ) ) {
86- program . parse ( process . argv )
87- genConfig ( program , templateFileName , definitionsFileName )
88- } else {
89- const projectRoot = getProjectRoot ( )
90- const rootPath = projectRoot === '' ? process . env . HOME : projectRoot
91-
92- const templateFilePath = getFilePath ( rootPath , templateFileName )
93- const definitionsFilePath = getFilePath ( rootPath , definitionsFileName )
94-
95- const template = fs . readFileSync ( templateFilePath , 'utf8' )
96- const definitions = loadDefinitions ( definitionsFilePath )
97- const terms = _ . keys ( definitions )
98-
99- customHelp ( program , templateFilePath , definitionsFilePath )
100-
101- setOptions ( program , definitions , terms ) . parse ( process . argv )
102-
103- main ( program , template , definitions , terms )
104- }
105- } catch ( e ) {
106- console . error ( `${ colors . error } ${ e . message } ${ colors . reset } ` )
107- e . status ? process . exit ( e . status ) : process . exit ( 1 )
75+ program
76+ . option ( '-d, --duet' , 'run git-duet mode' )
77+ . option ( '-D, --dry-run' , 'run dry-run mode' )
78+ . option ( '-i, --interactive' , 'run interactive mode' )
79+ . option ( '-S, --silent' , "don't show commit command" )
80+ . option ( '-t, --typo-check' , '[Already deleted this function] check spell' )
81+ . option ( '--gen-config' , 'generate config files' )
82+ . version ( version )
83+
84+ if ( process . argv . includes ( '--gen-config' ) ) {
85+ program . parse ( process . argv )
86+ genConfig ( program , templateFileName , definitionsFileName )
87+ } else {
88+ const projectRoot = getProjectRoot ( )
89+ const rootPath = projectRoot === '' ? process . env . HOME : projectRoot
90+
91+ const templateFilePath = getFilePath ( rootPath , templateFileName )
92+ const definitionsFilePath = getFilePath ( rootPath , definitionsFileName )
93+
94+ const template = fs . readFileSync ( templateFilePath , 'utf8' )
95+ const definitions = loadDefinitions ( definitionsFilePath )
96+ const terms = _ . keys ( definitions )
97+
98+ customHelp ( program , templateFilePath , definitionsFilePath )
99+
100+ setOptions ( program , definitions , terms ) . parse ( process . argv )
101+
102+ main ( program , template , definitions , terms ) . catch ( ( e ) => {
103+ console . error ( `${ colors . error } ${ e . message } ${ colors . reset } ` )
104+ e . status ? process . exit ( e . status ) : process . exit ( 1 )
105+ } )
108106}
0 commit comments