# CliService Service

Module
import { CliService } from "@tsed/cli-core"
Source/packages/cli-core/src/services/CliService.ts

# Overview

class CliService {
    readonly program: import("commander").Command;
    protected injector: InjectorService;
    protected hooks: CliHooks;
    protected projectPkg: ProjectPackageJson;
    protected pkg: CliPackageJson;
    parseArgs(argv: string[]): void;
    runLifecycle(cmdName: string, data?: any): Promise<any>;
    exec(cmdName: string, ctx: any): Promise<any>;
    prompt(cmdName: string, ctx?: any): Promise<any>;
    getTasks(cmdName: string, ctx: any): Promise<any[]>;
    getPostInstallTasks(cmdName: string, ctx: any): Promise<any[]>;
    buildOption(subCommand: Command, options: {
        [key: string]: CommandOptions;
    }, allowUnknownOptions: boolean): void;
    createCommand(metadata: CommandMetadata): any;
}

# Members

readonly program: import("commander").Command

protected injector: InjectorService

protected hooks: CliHooks

protected projectPkg: ProjectPackageJson

protected pkg: CliPackageJson

parseArgs(argv: string[]): void

Parse process.argv and runLifecycle action


runLifecycle(cmdName: string, data?: any): Promise<any>

Run lifecycle


exec(cmdName: string, ctx: any): Promise<any>

prompt(cmdName: string, ctx?: any): Promise<any>
Param Type Description
ctx any Optional. Initial data

Run prompt for a given command


getTasks(cmdName: string, ctx: any): Promise<any[]>

Run lifecycle


getPostInstallTasks(cmdName: string, ctx: any): Promise<any[]>

buildOption(subCommand: Command, options: {
     [key: string]: CommandOptions;
 }, allowUnknownOptions: boolean): void;

Build sub-command options


createCommand(metadata: CommandMetadata): any