rucken
Version:
Console tools and scripts for nx and not only that I (EndyKaufman) use to automate the workflow and speed up the development process
68 lines (67 loc) • 1.69 kB
TypeScript
export declare type ParserType = (value: string, previous: any) => any;
/**
* A Param decorator to inject the root cli
*/
export declare const InjectCli: () => ParameterDecorator;
/**
* The options of the command
* @see commander .option() to learn more
*/
export interface CommandOption {
/**
* The flags the command uses eg '-p,--port'
*/
flags: string;
/**
* The description of the option
*/
description?: string;
/**
* The function to parse the value
*/
fn?: ParserType;
/**
* The default value
*/
defaultValue?: any;
/**
* True if the option is required
*/
required?: boolean;
}
/**
* The interface to create a command
*/
export interface CreateCommandOptions {
/**
* The command with arguments
*
* eg: "mycommand <myargument> <mysecondargument>"
* @see commander .command() method for more details
*/
command: string;
/**
* The description of the command
*/
description?: string;
/**
* The alias of the command
*/
alias?: string;
/**
* A list of command options
*/
options?: CommandOption[];
}
/**
* The Command decorator is used to decorate a method in a class
* You can use it in a class that is deecorated by a "@Console" decorator
*/
export declare const Command: (options: CreateCommandOptions) => MethodDecorator;
/**
* The Console decorator is used to decorate a class
* All commands in class that are decorated by a "@Console" with identical name will be grouped
*
* eg "@Console({name: "mycommand"})"
*/
export declare const Console: (options?: CreateCommandOptions) => ClassDecorator;