Abstract
ConfigAggregator instance for accessing global and local configuration.
Add a progress bar to the console. Progress
Optional
projectAdd a spinner to the console. Spinner
Static
baseStatic
Optional
configurationAdd a CONFIGURATION VARIABLES section to the help output.
import { SfCommand, toHelpSection } from '@salesforce/sf-plugins-core';
import { OrgConfigProperties } from '@salesforce/core';
export default class MyCommand extends SfCommand {
public static configurationVariablesSection = toHelpSection(
'CONFIGURATION VARIABLES',
OrgConfigProperties.TARGET_ORG,
OrgConfigProperties.ORG_API_VERSION,
);
}
Static
enableStatic
Optional
envAdd an Environment VARIABLES section to the help output.
import { SfCommand, toHelpSection } from '@salesforce/sf-plugins-core';
import { EnvironmentVariable } from '@salesforce/core';
export default class MyCommand extends SfCommand {
public static envVariablesSection = toHelpSection(
'ENVIRONMENT VARIABLES',
EnvironmentVariable.SF_TARGET_ORG,
EnvironmentVariable.SF_USE_PROGRESS_BAR,
);
}
Static
Optional
errorAdd an ERROR CODES section to the help output.
Static
requiresSet to true if the command must be executed inside a Salesforce project directory.
If set to true the command will throw an error if the command is executed outside of a Salesforce project directory. Additionally, this.project will be set to the current Salesforce project (SfProject).
Prompt user for yes/no confirmation.
Avoid calling in --json scenarios and always provide a --no-prompt
option for scripting
Log info message to users.
SfCommand.Info The message to log.
Abstract
runPrompt user for yes/no confirmation.
Avoid calling in --json scenarios and always provide a --no-prompt
option for scripting
Log warning to users. If --json is enabled, then the warning will be added to the json output under the warnings property.
SfCommand.Warning The message to log.
A base command that provided common functionality for all sf commands. Functionality includes:
All implementations of this class need to implement the run() method.
Additionally, all implementations of this class need to provide a generic type that describes the JSON output.
See example implementation.
Example