Skip to content

Commit

Permalink
feat: warn users when using a beta command
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Mar 24, 2022
1 parent d258ce7 commit 2cf26f2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions messages/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,7 @@ Info:
# actions.tryThis

Try this:

# warning.CommandInBeta

This command is currently in beta. Any aspect of this command can change without advanced notice. Don't use beta commands in your scripts.
4 changes: 4 additions & 0 deletions src/sfCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,14 @@ export abstract class SfCommand<T> extends Command {
): Promise<R> {
return this.prompter.timedPrompt(questions, ms, initialAnswers);
}

public async _run<R>(): Promise<R | undefined> {
if (this.statics.requiresProject) {
this.project = await this.assignProject();
}
if (this.statics.state === 'beta') {
this.warn(messages.getMessage('warning.CommandInBeta'));
}
this.lifecycle.onWarning(async (warning: string) => {
this.warn(warning);
});
Expand Down

0 comments on commit 2cf26f2

Please sign in to comment.