import { CommandLineFlagParameter , CommandLineAction , CommandLineChoiceParameter } from '@rushstack/ts-command-line' ; import { BusinessLogic } from './BusinessLogic' ; export class PushAction extends CommandLineAction { private _force : CommandLineFlagParameter ; private _protocol : CommandLineChoiceParameter ; public constructor ( ) { super ( { actionName : 'push' , summary : 'Pushes a widget to the service' , documentation : 'Here we provide a longer description of how our action works.' } ) ; } protected onExecute ( ) { return BusinessLogic . doTheWork ( this . _force . value , this . _protocol . value || '(none)' ) ; } protected onDefineParameters ( ) { this . _force = this . defineFlagParameter ( { parameterLongName : '--force' , parameterShortName : '-f' , description : 'Push and overwrite any existing state' } ) ; this . _protocol = this . defineChoiceParameter ( { parameterLongName : '--protocol' , description : 'Specify the protocol to use' , alternatives : [ 'ftp' , 'webdav' , 'scp' ] , environmentVariable : 'WIDGET_PROTOCOL' , defaultValue : 'scp' } ) ; } }