1+ /* eslint-disable @typescript-eslint/require-await */
12import type { Disposable } from 'vscode' ;
23import type { CompareWithCommandArgs } from '../../../../commands/compareWith' ;
34import type { Container } from '../../../../container' ;
@@ -67,7 +68,7 @@ export class CliCommandHandlers implements Disposable {
6768 _request : CliCommandRequest ,
6869 repo ?: Repository | undefined ,
6970 ) : Promise < CliCommandResponse > {
70- return cherryPick ( repo ) ;
71+ void cherryPick ( repo ) ;
7172 }
7273
7374 @command ( 'compare' )
@@ -76,51 +77,48 @@ export class CliCommandHandlers implements Disposable {
7677 repo ?: Repository | undefined ,
7778 ) : Promise < CliCommandResponse > {
7879 if ( ! repo || ! _request . args ?. length ) {
79- await executeCommand ( 'gitlens.compareWith' ) ;
80+ void executeCommand ( 'gitlens.compareWith' ) ;
8081 return ;
8182 }
8283
8384 const [ ref1 , ref2 ] = _request . args ;
8485 if ( ! ref1 || ! ref2 ) {
85- await executeCommand ( 'gitlens.compareWith' ) ;
86+ void executeCommand ( 'gitlens.compareWith' ) ;
8687 return ;
8788 }
8889
8990 if ( ref1 ) {
9091 if ( ! ( await repo . git . refs ( ) . validateReference ( ref1 ) ) ) {
91- // TODO: Send an error back to the CLI?
92- await executeCommand ( 'gitlens.compareWith' ) ;
93- return ;
92+ void executeCommand ( 'gitlens.compareWith' ) ;
93+ return { stderr : `${ ref1 } is an invalid reference` } ;
9494 }
9595 }
9696
9797 if ( ref2 ) {
9898 if ( ! ( await repo . git . refs ( ) . validateReference ( ref2 ) ) ) {
99- // TODO: Send an error back to the CLI?
100- await executeCommand < CompareWithCommandArgs > ( 'gitlens.compareWith' , { ref1 : ref1 } ) ;
101- return ;
99+ void executeCommand < CompareWithCommandArgs > ( 'gitlens.compareWith' , { ref1 : ref1 } ) ;
100+ return { stderr : `${ ref2 } is an invalid reference` } ;
102101 }
103102 }
104103
105- await executeCommand < CompareWithCommandArgs > ( 'gitlens.compareWith' , { ref1 : ref1 , ref2 : ref2 } ) ;
104+ void executeCommand < CompareWithCommandArgs > ( 'gitlens.compareWith' , { ref1 : ref1 , ref2 : ref2 } ) ;
106105 }
107106
108107 @command ( 'graph' )
109108 async handleGraphCommand ( request : CliCommandRequest , repo ?: Repository | undefined ) : Promise < CliCommandResponse > {
110109 if ( ! repo || ! request . args ?. length ) {
111- await executeCommand ( 'gitlens.showGraphView' ) ;
110+ void executeCommand ( 'gitlens.showGraphView' ) ;
112111 return ;
113112 }
114113
115114 const [ ref ] = request . args ;
116115 const reference = await repo . git . refs ( ) . getReference ( ref ) ;
117116 if ( ref && ! reference ) {
118- // TODO: Send an error back to the CLI?
119- await executeCommand ( 'gitlens.showInCommitGraph' , repo ) ;
120- return ;
117+ void executeCommand ( 'gitlens.showInCommitGraph' , repo ) ;
118+ return { stderr : `${ ref } is an invalid reference` } ;
121119 }
122120
123- await executeCommand ( 'gitlens.showInCommitGraph' , { ref : reference } ) ;
121+ void executeCommand ( 'gitlens.showInCommitGraph' , { ref : reference } ) ;
124122 }
125123
126124 @command ( 'merge' )
@@ -129,10 +127,12 @@ export class CliCommandHandlers implements Disposable {
129127
130128 const [ ref ] = request . args ;
131129 const reference = await repo . git . refs ( ) . getReference ( ref ) ;
130+
131+ void merge ( repo , reference ) ;
132+
132133 if ( ref && ! reference ) {
133- // TODO: Send an error back to the CLI?
134+ return { stderr : ` ${ ref } is an invalid reference` } ;
134135 }
135- return merge ( repo , reference ) ;
136136 }
137137
138138 @command ( 'rebase' )
@@ -141,10 +141,11 @@ export class CliCommandHandlers implements Disposable {
141141
142142 const [ ref ] = request . args ;
143143 const reference = await repo . git . refs ( ) . getReference ( ref ) ;
144+
145+ void rebase ( repo , reference ) ;
146+
144147 if ( ref && ! reference ) {
145- // TODO: Send an error back to the CLI?
148+ return { stderr : ` ${ ref } is an invalid reference` } ;
146149 }
147-
148- return rebase ( repo , reference ) ;
149150 }
150151}
0 commit comments