Skip to content

Commit

Permalink
fix: make toHelpSection types more friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Mar 2, 2022
1 parent 7bf8b96 commit 8df1f41
Show file tree
Hide file tree
Showing 3 changed files with 262 additions and 61 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
],
"dependencies": {
"@oclif/core": "^1.2.0",
"@salesforce/core": "3.7.3",
"@salesforce/core": "^3.7.7",
"@salesforce/kit": "^1.5.17",
"@salesforce/ts-types": "^1.5.20",
"inquirer": "^8.2.0"
Expand Down
16 changes: 10 additions & 6 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { HelpSection } from '@oclif/core';
import {
ORG_CONFIG_ALLOWED_PROPERTIES,
EnvironmentVariable,
OrgConfigProperties,
SFDX_ALLOWED_PROPERTIES,
ORG_CONFIG_ALLOWED_PROPERTIES,
SfdxPropertyKeys,
EnvironmentVariable,
SFDX_ALLOWED_PROPERTIES,
SUPPORTED_ENV_VARS,
} from '@salesforce/core';

export type HelpSection = {
header: string;
body: Array<{ name: string; description: string } | undefined>;
};

/**
* Function to build a help section for command help.
* Takes a string to be used as section header text and an array of enums
Expand All @@ -26,7 +30,7 @@ import {
*/
export function toHelpSection(
header: string,
...vars: Array<OrgConfigProperties | SfdxPropertyKeys | EnvironmentVariable>
...vars: Array<OrgConfigProperties | SfdxPropertyKeys | EnvironmentVariable | string>
): HelpSection {
const body = vars
.map((v) => {
Expand All @@ -49,5 +53,5 @@ export function toHelpSection(
return undefined;
})
.filter((b) => b);
return { header, body } as HelpSection;
return { header, body };
}
Loading

0 comments on commit 8df1f41

Please sign in to comment.