forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WidgetCommandLine.ts
36 lines (30 loc) · 1.11 KB
/
WidgetCommandLine.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 { CommandLineParser, CommandLineFlagParameter } from '@rushstack/ts-command-line';
import { PushAction } from './PushAction';
import { RunAction } from './RunAction';
import { BusinessLogic } from './BusinessLogic';
export class WidgetCommandLine extends CommandLineParser {
private _verbose: CommandLineFlagParameter;
public constructor() {
super({
toolFilename: 'widget',
toolDescription: 'The "widget" tool is a code sample for using the @rushstack/ts-command-line library.'
});
this.addAction(new PushAction());
this.addAction(new RunAction());
}
protected onDefineParameters(): void {
// abstract
this._verbose = this.defineFlagParameter({
parameterLongName: '--verbose',
parameterShortName: '-v',
description: 'Show extra logging detail'
});
}
protected onExecute(): Promise<void> {
// override
BusinessLogic.configureLogger(this._verbose.value);
return super.onExecute();
}
}