Home Manual Reference Source
import {CLICleanCommand} from 'projext/src/services/cli/cliClean.js'
public class | source

CLICleanCommand

Extends:

CLICommand → CLICleanCommand

This is the command used on the CLI interface to remove a target file(s) or the entire distribution directory.

Constructor Summary

Public Constructor
public

constructor(builder: Builder, buildCleaner: BuildCleaner, targets: Targets)

Class constructor.

Member Summary

Public Members
public

A local reference for the buildCleaner service function.

public

A local reference for the builder service function.

public

The instruction needed to trigger the command.

public

A description of the command for the help interface.

public

A local reference for the targets service function.

Method Summary

Public Methods
public

handle(name: string, command: Command, options: Object): Promise<undefined, Error>

Handle the execution of the command.

Inherited Summary

From class CLICommand
public

Whether or not the command supports unknown options.

public

This is a useful flag for when the command is ran as a result of another command.

public

This is the name of the program that runs the command.

public

The CLI command instruction.

public

A description of the command for the help interface.

public

A more complete description of the command to show when the command help interface is invoked.

public

Whether the command and its description should be shown on the CLI interface list of commands.

public

A list with the name of the options the command supports.

public

A dictionary of command options settings by their option name.

public

Whether or not a sub program should be executed for this command.

private

This dictionary will be completed when the command gets activated.

public

addOption(name: string, instruction: string, description: string, defaultValue: string)

Add a new option for the command.

public

Generate an instruction for this command.

public abstract

handle()

Handle the command execution.

public

output(text: string)

A simple wrapper for a console.log.

public

register(program: Command, cli: Object)

Register this command on a CLI program.

Public Constructors

public constructor(builder: Builder, buildCleaner: BuildCleaner, targets: Targets) source

Class constructor.

Override:

CLICommand#constructor

Params:

NameTypeAttributeDescription
builder Builder

Needed to remove a target files.

buildCleaner BuildCleaner

Needed to remove the distribution directory.

targets Targets

To get the default target in case none is specified.

Public Members

public buildCleaner: BuildCleaner source

A local reference for the buildCleaner service function.

public builder: Builder source

A local reference for the builder service function.

public command: string source

The instruction needed to trigger the command.

Override:

CLICommand#command

public description: string source

A description of the command for the help interface.

Override:

CLICommand#description

public targets: Targets source

A local reference for the targets service function.

Public Methods

public handle(name: string, command: Command, options: Object): Promise<undefined, Error> source

Handle the execution of the command.

Override:

CLICommand#handle

Params:

NameTypeAttributeDescription
name string
  • nullable: true

The name of the target that will be removed from the distribution directory. If none is specified, it will fallback to the default target.

command Command

The executed command (sent by commander).

options Object

The commands options.

options.all boolean

If this is true, instead of just removing the target files, the entire distribution directory will be deleted.

Return:

Promise<undefined, Error>