Skip to main content

Commander

Commander service that is responsible for handling command line interface operations

API Reference​

CommanderCli​

Kind: Exported class

new CommanderCli()

Create an instance of the CommanderCli class

Example Basic usage:

import { CommanderCli } from "@ecoflow/cli";

const commander = new CommanderCli();

Parse Arguments​

commander.parseArgs() ⇒ CommanderCli

Parse the command line arguments.

commander.parseArgs();

Return: The CommanderCli instance after parsing the arguments

Set Uses Message​

commander.usesMsgs(str) ⇒ CommanderCli

Sets the usage message for the Commander CLI command

Example Basic usage:

commander.usesMsgs(
`[-?] [-h] [--settings settings.js] [--userDir DIR]
[--port PORT] [--title TITLE] [--safe] [flows.json]

ecoflow admin <command> [args] [-?] [--userDir DIR] [--json]`
);

Return: The CommanderCli instance.

Available arguments :

ParameterTypeDescription
strstringThe usage message to be displayed

Arguments​

commander.args ⇒ object

Return an object containing the arguments stored in it.

Example Basic usage:

const args = commander.args;

console.log(args);

Return: object

CLI Service​

commander.CliService ⇒ CliService

Returns an instance of the CliService class.