Skip to content

Commit

Permalink
feat: use sfdx's apiversion and loglevel flags
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Nov 15, 2022
1 parent e7b4342 commit 77f5bd5
Show file tree
Hide file tree
Showing 2 changed files with 52 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 @@ -66,6 +66,10 @@ The value must be between %s and %s (inclusive).

Warning:

# warning.loglevel

The loglevel flag is no longer in use on this command. You may use it without error, but it will be ignored.

# actions.tryThis

Try this:
Expand Down
48 changes: 48 additions & 0 deletions src/compatibility.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2020, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { Flags } from '@oclif/core';
import { Messages } from '@salesforce/core';
import { orgApiVersionFlag } from './flags/orgApiVersion';

/**
* Adds an alias for the deprecated sfdx-style "apiversion" and provides a warning if it is used
* See orgApiVersionFlag for full details
*
* @deprecated
* @example
* ```
* import { Flags } from '@salesforce/sf-plugins-core';
* public static flags = {
* 'api-version': Flags.orgApiVersion({
* char: 'a',
* description: 'api version for the org'
* }),
* }
* ```
*/
export const orgApiVersionFlagWithDeprecations = orgApiVersionFlag({
aliases: ['apiversion'],
deprecateAliases: true,
});

Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');
/**
* Use only for commands that maintain sfdx compatibility.
* Flag will be hidden and will show a warning if used.
* Flag does *not* set the loglevel
*
* @deprecated
*
*/
export const loglevel = Flags.string({
hidden: true,
deprecated: {
message: messages.getMessage('warning.loglevel'),
},
});

0 comments on commit 77f5bd5

Please sign in to comment.