import { ParamType } from './params' ; import { BaseParamOptions , CommanderOptionParams , BaseParam } from './base-param' ; export interface ComplexListChoice { name : string ; value ? : any ; disabled ? : boolean ; short ? : string ; } export interface ListParamOptions extends BaseParamOptions { choices : string [ ] | ComplexListChoice [ ] ; pageSize ? : number ; } export class ListParam extends BaseParam { protected type = ParamType . list ; constructor ( protected options ) { super ( options ) ; } get commanderOption ( ) : CommanderOptionParams { const optionParams = [ `-${ this . options . alias }, --${ this . options . name } <${ this . options . name }>` , this . options . title ] ; if ( this . options . processor !== undefined ) { optionParams . push ( this . options . processor ) ; } if ( this . options . default !== undefined ) { optionParams . push ( this . options . default ) ; } return optionParams ; } get inquirerOption ( ) { return { type : this . type , name : this . options . name , message : this . options . title , choices : this . options . choices , pageSize : this . options . pageSize } ; } }