UNPKG

1.75 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google Inc. All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { analytics, logging } from '@angular-devkit/core';
9import { Arguments, CommandContext, CommandDescription, CommandDescriptionMap, CommandScope, CommandWorkspace, Option, SubCommandDescription } from './interface';
10export interface BaseCommandOptions {
11 help?: boolean | string;
12}
13export declare abstract class Command<T extends BaseCommandOptions = BaseCommandOptions> {
14 readonly description: CommandDescription;
15 protected readonly logger: logging.Logger;
16 allowMissingWorkspace: boolean;
17 workspace: CommandWorkspace;
18 analytics: analytics.Analytics;
19 protected static commandMap: () => Promise<CommandDescriptionMap>;
20 static setCommandMap(map: () => Promise<CommandDescriptionMap>): void;
21 constructor(context: CommandContext, description: CommandDescription, logger: logging.Logger);
22 initialize(options: T & Arguments): Promise<void>;
23 printHelp(options: T & Arguments): Promise<number>;
24 printJsonHelp(_options: T & Arguments): Promise<number>;
25 protected printHelpUsage(): Promise<void>;
26 protected printHelpSubcommand(subcommand: SubCommandDescription): Promise<void>;
27 protected printHelpOptions(options?: Option[]): Promise<void>;
28 validateScope(scope?: CommandScope): Promise<void>;
29 reportAnalytics(paths: string[], options: T & Arguments, dimensions?: (boolean | number | string)[], metrics?: (boolean | number | string)[]): Promise<void>;
30 abstract run(options: T & Arguments): Promise<number | void>;
31 validateAndRun(options: T & Arguments): Promise<number | void>;
32}