AbstractConfigAggregator instance for accessing global and local configuration.
Add a progress bar to the console. Progress
OptionalprojectAdd a spinner to the console. Spinner
StaticbaseStatic OptionalconfigurationAdd 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,
);
}
StaticenableStatic OptionalenvAdd 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 OptionalerrorAdd an ERROR CODES section to the help output.
StaticrequiresSet 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
text to display. Do not include a question mark or Y/N.
Determine if the command is being run with the --json flag in a command that supports it.
true if the command supports json and the --json flag is present
Warn user about sensitive information (access tokens, etc...) before logging to the console.
Optionalmsg: string
The message to log.
Log a success message that has the standard success message color applied.
The message to log.
Abstractrunactual command run code goes here
Prompt user for yes/no confirmation.
Avoid calling in --json scenarios and always provide a --no-prompt option for scripting
text to display. Do not include a question mark.
Log stylized header to the console. Will automatically be suppressed when --json flag is present.
the text to display as a header.
Log stylized JSON to the console. Will automatically be suppressed when --json flag is present.
The JSON to log.
Log stylized object to the console. Will automatically be suppressed when --json flag is present.
The object to log.
Display a table on the console. Will automatically be suppressed when --json flag is present.
Log a stylized url to the console. Will automatically be suppressed when --json flag is present.
The text to display for the url.
The url to display.
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