---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [cli](../index.md) / BaseCommand

# Abstract Class: BaseCommand\<T\>

Defined in: [packages/b2c-tooling-sdk/src/cli/base-command.ts:65](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/cli/base-command.ts#L65)

Base command class for B2C CLI tools.

Environment variables for logging:
- SFCC_JSON_LOGS: Output log messages as JSON lines (for log aggregation)
- SFCC_LOG_TO_STDOUT: Send logs to stdout instead of stderr
- SFCC_LOG_COLORIZE: Force colors on/off (default: auto-detect TTY)
- SFCC_REDACT_SECRETS: Set to 'false' to disable secret redaction
- NO_COLOR: Industry standard to disable colors

Environment variables for telemetry:
- SF_DISABLE_TELEMETRY: Set to 'true' to disable telemetry (sf CLI standard)
- SFCC_DISABLE_TELEMETRY: Set to 'true' to disable telemetry
- SFCC_APP_INSIGHTS_KEY: Override connection string from package.json

## Extends

- `Command`

## Extended by

- [`OAuthCommand`](OAuthCommand.md)
- [`MrtCommand`](MrtCommand.md)

## Type Parameters

### T

`T` *extends* *typeof* `Command`

## Constructors

### Constructor

> **new BaseCommand**\<`T`\>(`argv`, `config`): `BaseCommand`\<`T`\>

Defined in: node\_modules/@oclif/core/lib/command.d.ts:77

#### Parameters

##### argv

`string`[]

##### config

`Config`

#### Returns

`BaseCommand`\<`T`\>

#### Inherited from

`Command.constructor`

## Properties

### argv

> **argv**: `string`[]

Defined in: node\_modules/@oclif/core/lib/command.d.ts:12

#### Inherited from

`Command.argv`

***

### config

> **config**: `Config`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:13

#### Inherited from

`Command.config`

***

### id

> **id**: `string` \| `undefined`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:75

#### Inherited from

[`OAuthCommand`](OAuthCommand.md).[`id`](OAuthCommand.md#id)

***

### parsed

> **parsed**: `boolean`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:76

#### Inherited from

`Command.parsed`

***

### aliases

> `static` **aliases**: `string`[]

Defined in: node\_modules/@oclif/core/lib/command.d.ts:16

An array of aliases for this command.

#### Inherited from

`Command.aliases`

***

### args

> `static` **args**: `ArgInput`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:18

An order-dependent object of arguments for the command

#### Inherited from

`Command.args`

***

### baseFlags

> `static` **baseFlags**: `object`

Defined in: [packages/b2c-tooling-sdk/src/cli/base-command.ts:66](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/cli/base-command.ts#L66)

#### config

> **config**: `OptionFlag`\<`string` \| `undefined`, `CustomOptions`\>

#### debug

> **debug**: `BooleanFlag`\<`boolean`\>

#### extra-body

> **extra-body**: `OptionFlag`\<`string` \| `undefined`, `CustomOptions`\>

#### extra-headers

> **extra-headers**: `OptionFlag`\<`string` \| `undefined`, `CustomOptions`\>

#### extra-query

> **extra-query**: `OptionFlag`\<`string` \| `undefined`, `CustomOptions`\>

#### instance

> **instance**: `OptionFlag`\<`string` \| `undefined`, `CustomOptions`\>

#### json

> **json**: `BooleanFlag`\<`boolean`\>

#### jsonl

> **jsonl**: `BooleanFlag`\<`boolean`\>

#### lang

> **lang**: `OptionFlag`\<`string` \| `undefined`, `CustomOptions`\>

#### log-level

> **log-level**: `OptionFlag`\<`"trace"` \| `"debug"` \| `"info"` \| `"warn"` \| `"error"` \| `"silent"` \| `undefined`, `CustomOptions`\>

#### project-directory

> **project-directory**: `OptionFlag`\<`string`, `CustomOptions`\>

#### Overrides

`Command.baseFlags`

***

### deprecateAliases?

> `static` `optional` **deprecateAliases**: `boolean`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:23

Emit deprecation warning when a command alias is used

#### Inherited from

`Command.deprecateAliases`

***

### deprecationOptions?

> `static` `optional` **deprecationOptions**: `Deprecation`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:24

#### Inherited from

`Command.deprecationOptions`

***

### description

> `static` **description**: `string` \| `undefined`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:30

A full description of how to use the command.

If no summary, the first line of the description will be used as the summary.

#### Inherited from

`Command.description`

***

### enableJsonFlag

> `static` **enableJsonFlag**: `boolean`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:31

#### Inherited from

`Command.enableJsonFlag`

***

### examples

> `static` **examples**: `Example`[]

Defined in: node\_modules/@oclif/core/lib/command.d.ts:46

An array of examples to show at the end of the command's help.

IF only a string is provided, it will try to look for a line that starts
with the cmd.bin as the example command and the rest as the description.
If found, the command will be formatted appropriately.

```
EXAMPLES:
  A description of a particular use case.

    $ <%= config.bin => command flags
```

#### Inherited from

`Command.examples`

***

### flags

> `static` **flags**: `FlagInput`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:48

A hash of flags for the command

#### Inherited from

`Command.flags`

***

### hasDynamicHelp

> `static` **hasDynamicHelp**: `boolean`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:49

#### Inherited from

`Command.hasDynamicHelp`

***

### help

> `static` **help**: `string` \| `undefined`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:50

#### Inherited from

`Command.help`

***

### hidden

> `static` **hidden**: `boolean`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:52

Hide the command from help

#### Inherited from

`Command.hidden`

***

### hiddenAliases

> `static` **hiddenAliases**: `string`[]

Defined in: node\_modules/@oclif/core/lib/command.d.ts:54

An array of aliases for this command that are hidden from help.

#### Inherited from

`Command.hiddenAliases`

***

### id

> `static` **id**: `string`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:56

A command ID, used mostly in error or verbose reporting.

#### Inherited from

`Command.id`

***

### plugin

> `static` **plugin**: `Plugin` \| `undefined`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:57

#### Inherited from

`Command.plugin`

***

### pluginAlias?

> `readonly` `static` `optional` **pluginAlias**: `string`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:58

#### Inherited from

`Command.pluginAlias`

***

### pluginName?

> `readonly` `static` `optional` **pluginName**: `string`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:59

#### Inherited from

`Command.pluginName`

***

### pluginType?

> `readonly` `static` `optional` **pluginType**: `string`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:60

#### Inherited from

`Command.pluginType`

***

### state?

> `static` `optional` **state**: `string`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:62

Mark the command as a given state (e.g. beta or deprecated) in help

#### Inherited from

`Command.state`

***

### strict

> `static` **strict**: `boolean`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:64

When set to false, allows a variable amount of arguments

#### Inherited from

`Command.strict`

***

### summary?

> `static` `optional` **summary**: `string`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:69

The tweet-sized description for your class, used in a parent-commands
sub-command listing and as the header for the command help.

#### Inherited from

`Command.summary`

***

### usage

> `static` **usage**: `string` \| `string`[] \| `undefined`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:73

An override string (or strings) for the default usage documentation.

#### Inherited from

`Command.usage`

## Methods

### baseCommandTest()

> **baseCommandTest**(): `void`

Defined in: [packages/b2c-tooling-sdk/src/cli/base-command.ts:617](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/cli/base-command.ts#L617)

#### Returns

`void`

***

### error()

#### Call Signature

> **error**(`input`, `options`): `void`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:90

##### Parameters

###### input

`string` | `Error`

###### options

`object` & `PrettyPrintableError`

##### Returns

`void`

##### Inherited from

`Command.error`

#### Call Signature

> **error**(`input`, `options?`): `never`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:94

##### Parameters

###### input

`string` | `Error`

###### options?

`object` & `PrettyPrintableError`

##### Returns

`never`

##### Inherited from

`Command.error`

***

### exit()

> **exit**(`code?`): `never`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:98

#### Parameters

##### code?

`number`

#### Returns

`never`

#### Inherited from

`Command.exit`

***

### init()

> **init**(): `Promise`\<`void`\>

Defined in: [packages/b2c-tooling-sdk/src/cli/base-command.ts:149](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/cli/base-command.ts#L149)

#### Returns

`Promise`\<`void`\>

#### Overrides

`Command.init`

***

### jsonEnabled()

> **jsonEnabled**(): `boolean`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:106

Determine if the command is being run with the --json flag in a command that supports it.

#### Returns

`boolean`

true if the command supports json and the --json flag is present

#### Inherited from

`Command.jsonEnabled`

***

### log()

> **log**(`message?`, ...`args?`): `void`

Defined in: [packages/b2c-tooling-sdk/src/cli/base-command.ts:315](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/cli/base-command.ts#L315)

Override oclif's log() to use pino.

#### Parameters

##### message?

`string`

##### args?

...`unknown`[]

#### Returns

`void`

#### Overrides

`Command.log`

***

### logToStderr()

> **logToStderr**(`message?`, ...`args?`): `void`

Defined in: node\_modules/@oclif/core/lib/command.d.ts:109

#### Parameters

##### message?

`string`

##### args?

...`any`[]

#### Returns

`void`

#### Inherited from

`Command.logToStderr`

***

### run()

> `abstract` **run**(): `Promise`\<`any`\>

Defined in: node\_modules/@oclif/core/lib/command.d.ts:114

actual command run code goes here

#### Returns

`Promise`\<`any`\>

#### Inherited from

`Command.run`

***

### warn()

> **warn**(`input`): `string` \| `Error`

Defined in: [packages/b2c-tooling-sdk/src/cli/base-command.ts:324](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/cli/base-command.ts#L324)

Override oclif's warn() to use pino.

#### Parameters

##### input

`string` | `Error`

#### Returns

`string` \| `Error`

#### Overrides

`Command.warn`

***

### run()

> `static` **run**\<`T`\>(`this`, `argv?`, `opts?`): `Promise`\<`ReturnType`\<`T`\[`"run"`\]\>\>

Defined in: node\_modules/@oclif/core/lib/command.d.ts:86

instantiate and run the command

#### Type Parameters

##### T

`T` *extends* `Command`

#### Parameters

##### this

(`argv`, `config`) => `T`

the command class

##### argv?

`string`[]

argv

##### opts?

`LoadOptions`

options

#### Returns

`Promise`\<`ReturnType`\<`T`\[`"run"`\]\>\>

result

#### Inherited from

`Command.run`
