UNPKG

1.87 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC 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 { BaseException, logging } from '@angular-devkit/core';
9import { Arguments, Option } from './interface';
10export declare class ParseArgumentException extends BaseException {
11 readonly comments: string[];
12 readonly parsed: Arguments;
13 readonly ignored: string[];
14 constructor(comments: string[], parsed: Arguments, ignored: string[]);
15}
16/**
17 * Parse the arguments in a consistent way, but without having any option definition. This tries
18 * to assess what the user wants in a free form. For example, using `--name=false` will set the
19 * name properties to a boolean type.
20 * This should only be used when there's no schema available or if a schema is "true" (anything is
21 * valid).
22 *
23 * @param args Argument list to parse.
24 * @returns An object that contains a property per flags from the args.
25 */
26export declare function parseFreeFormArguments(args: string[]): Arguments;
27/**
28 * Parse the arguments in a consistent way, from a list of standardized options.
29 * The result object will have a key per option name, with the `_` key reserved for positional
30 * arguments, and `--` will contain everything that did not match. Any key that don't have an
31 * option will be pushed back in `--` and removed from the object. If you need to validate that
32 * there's no additionalProperties, you need to check the `--` key.
33 *
34 * @param args The argument array to parse.
35 * @param options List of supported options. {@see Option}.
36 * @param logger Logger to use to warn users.
37 * @returns An object that contains a property per option.
38 */
39export declare function parseArguments(args: string[], options: Option[] | null, logger?: logging.Logger): Arguments;