Skip to content

Commit

Permalink
fix: revert pr #33 (caused downstream type problems)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Dec 30, 2022
1 parent 8a61da0 commit 1cc7e07
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@ import {
SUPPORTED_ENV_VARS,
Messages,
} from '@salesforce/core';
import { HelpSection, HelpSectionKeyValueTable } from '@oclif/core';

Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');

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 Down Expand Up @@ -58,10 +54,13 @@ export function toHelpSection(
return Object.entries(v).map(([name, description]) => ({ name, description }));
}
})
.filter((b) => b);
.filter(isHelpSectionBodyEntry);
return { header, body };
}

const isHelpSectionBodyEntry = (entry: unknown): entry is HelpSectionKeyValueTable[number] =>
typeof entry === 'object' && entry !== null && 'name' in entry && 'description' in entry;

export function parseVarArgs(args: Record<string, unknown>, argv: string[]): Record<string, string | undefined> {
const final: Record<string, string | undefined> = {};
const argVals = Object.values(args);
Expand Down

0 comments on commit 1cc7e07

Please sign in to comment.