-
Notifications
You must be signed in to change notification settings - Fork 604
/
RunAction.ts
36 lines (30 loc) · 1.24 KB
/
RunAction.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
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import { CommandLineAction, CommandLineStringParameter } from '@rushstack/ts-command-line';
export class RunAction extends CommandLineAction {
private _title: CommandLineStringParameter;
public constructor() {
super({
actionName: 'run',
summary: 'This action (hypothetically) passes its command line arguments to the shell to be executed.',
documentation: 'This demonstrates how to use the defineCommandLineRemainder() API.'
});
}
protected async onExecute(): Promise<void> {
// abstract
console.log(`Console Title: ${this._title.value || '(none)'}`);
console.log('Arguments to be executed: ' + JSON.stringify(this.remainder!.values));
}
protected onDefineParameters(): void {
// abstract
this._title = this.defineStringParameter({
parameterLongName: '--title',
argumentName: 'TITLE',
environmentVariable: 'WIDGET_TITLE',
description: 'An optional title to show in the console window'
});
this.defineCommandLineRemainder({
description: 'The remaining arguments are passed along to the command shell.'
});
}
}