@@ -29,12 +29,15 @@ interface Context {
2929 title : string ;
3030}
3131
32- type Flags = '--hard' | '--soft' ;
32+ type ResetOptions = {
33+ hard ?: boolean ;
34+ soft ?: boolean ;
35+ } ;
3336
3437interface State {
3538 repo : string | Repository ;
3639 reference : GitRevisionReference | GitTagReference ;
37- flags : Flags [ ] ;
40+ options : ResetOptions ;
3841}
3942
4043export interface ResetGitCommandArgs {
@@ -73,7 +76,7 @@ export class ResetGitCommand extends QuickCommand<State> {
7376
7477 async execute ( state : ResetStepState ) {
7578 try {
76- await state . repo . git . reset ( state . flags , state . reference . ref ) ;
79+ await state . repo . git . reset ( state . options , state . reference . ref ) ;
7780 } catch ( ex ) {
7881 Logger . error ( ex , this . title ) ;
7982 void showGenericErrorMessage ( ex . message ) ;
@@ -89,8 +92,8 @@ export class ResetGitCommand extends QuickCommand<State> {
8992 title : this . title ,
9093 } ;
9194
92- if ( state . flags == null ) {
93- state . flags = [ ] ;
95+ if ( state . options == null ) {
96+ state . options = { } ;
9497 }
9598
9699 let skippedStepOne = false ;
@@ -159,7 +162,7 @@ export class ResetGitCommand extends QuickCommand<State> {
159162 const result = yield * this . confirmStep ( state as ResetStepState , context ) ;
160163 if ( result === StepResultBreak ) continue ;
161164
162- state . flags = result ;
165+ state . options = Object . assign ( { } , ... result ) ;
163166 }
164167
165168 endSteps ( state ) ;
@@ -169,24 +172,24 @@ export class ResetGitCommand extends QuickCommand<State> {
169172 return state . counter < 0 ? StepResultBreak : undefined ;
170173 }
171174
172- private * confirmStep ( state : ResetStepState , context : Context ) : StepResultGenerator < Flags [ ] > {
173- const step : QuickPickStep < FlagsQuickPickItem < Flags > > = this . createConfirmStep (
175+ private * confirmStep ( state : ResetStepState , context : Context ) : StepResultGenerator < ResetOptions [ ] > {
176+ const step : QuickPickStep < FlagsQuickPickItem < ResetOptions > > = this . createConfirmStep (
174177 appendReposToTitle ( `Confirm ${ context . title } ` , state , context ) ,
175178 [
176- createFlagsQuickPickItem < Flags > ( state . flags , [ ] , {
179+ createFlagsQuickPickItem < ResetOptions > ( [ ] , [ ] , {
177180 label : this . title ,
178181 detail : `Will reset (leaves changes in the working tree) ${ getReferenceLabel (
179182 context . destination ,
180183 ) } to ${ getReferenceLabel ( state . reference ) } `,
181184 } ) ,
182- createFlagsQuickPickItem < Flags > ( state . flags , [ '-- soft' ] , {
185+ createFlagsQuickPickItem < ResetOptions > ( [ ] , [ { soft : true } ] , {
183186 label : `Soft ${ this . title } ` ,
184187 description : '--soft' ,
185188 detail : `Will soft reset (leaves changes in the index and working tree) ${ getReferenceLabel (
186189 context . destination ,
187190 ) } to ${ getReferenceLabel ( state . reference ) } `,
188191 } ) ,
189- createFlagsQuickPickItem < Flags > ( state . flags , [ '-- hard' ] , {
192+ createFlagsQuickPickItem < ResetOptions > ( [ ] , [ { hard : true } ] , {
190193 label : `Hard ${ this . title } ` ,
191194 description : '--hard' ,
192195 detail : `Will hard reset (discards all changes) ${ getReferenceLabel (
0 commit comments