forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PushAction.ts
44 lines (38 loc) · 1.31 KB
/
PushAction.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
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(): Promise<void> {
// abstract
return BusinessLogic.doTheWork(this._force.value, this._protocol.value || '(none)');
}
protected onDefineParameters(): void {
// abstract
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'
});
}
}