@yolkai/nx-tao
Version:
56 lines (55 loc) • 1.75 kB
TypeScript
import { logging } from '@angular-devkit/core';
export declare type Schema = {
properties: {
[p: string]: any;
};
required: string[];
description: string;
};
export declare type Unmatched = {
name: string;
possible: string[];
};
export declare type Options = {
'--'?: Unmatched[];
[k: string]: any;
};
export declare function handleErrors(logger: logging.Logger, isVerbose: boolean, fn: Function): Promise<any>;
export declare function convertToCamelCase(parsed: Options): Options;
/**
* Coerces (and replaces) options identified as 'boolean' or 'number' in the Schema
*
* @param opts The options to check
* @param schema The schema definition with types to check against
*
*/
export declare function coerceTypes(opts: Options, schema: Schema): Options;
/**
* Converts any options passed in with short aliases to their full names if found
* Unmatched options are added to opts['--']
*
* @param opts The options passed in by the user
* @param schema The schema definition to check against
*/
export declare function convertAliases(opts: Options, schema: Schema): Options;
/**
* Tries to find what the user meant by unmatched commands
*
* @param opts The options passed in by the user
* @param schema The schema definition to check against
*
*/
export declare function lookupUnmatched(opts: Options, schema: Schema): Options;
/**
* Converts aliases and coerces types according to the schema
*
* @param opts The options to check
* @param schema The schema definition to validate against
*
* @remarks
*
* Unmatched options are added to opts['--']
* and listed along with possible schema matches
*
*/
export declare function validateOptions(opts: Options, schema: Schema): Options;