Skip to content

Commit

Permalink
fix: use OptionFlag interface so that exactlyOne can be used
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Mar 17, 2022
1 parent a14769b commit 0e65453
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/flags/duration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const messages = Messages.loadMessages('@salesforce/sf-plugins-core', 'messages'

type DurationUnit = Lowercase<keyof typeof Duration.Unit>;

export interface DurationFlagConfig extends Partial<Interfaces.OptionFlagProps> {
export interface DurationFlagConfig extends Partial<Interfaces.OptionFlag<Duration>> {
unit: Required<DurationUnit>;
defaultValue?: number;
min?: number;
Expand Down
10 changes: 5 additions & 5 deletions src/flags/orgFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const optionalOrgFlag = Flags.build<Org | undefined>({
char: 'e',
parse: async (input: string | undefined) => await maybeGetOrg(input),
default: async () => await maybeGetOrg(),
defaultHelp: async () => (await maybeGetOrg(undefined))?.getUsername(),
defaultHelp: async () => (await maybeGetOrg())?.getUsername(),
});

/**
Expand All @@ -83,8 +83,8 @@ export const optionalOrgFlag = Flags.build<Org | undefined>({
export const requiredOrgFlag = Flags.build<Org>({
char: 'e',
parse: async (input: string | undefined) => await getOrgOrThrow(input),
default: async () => await getOrgOrThrow(undefined),
defaultHelp: async () => (await getOrgOrThrow(undefined))?.getUsername(),
default: async () => await getOrgOrThrow(),
defaultHelp: async () => (await getOrgOrThrow())?.getUsername(),
});

/**
Expand All @@ -109,6 +109,6 @@ export const requiredOrgFlag = Flags.build<Org>({
export const requiredHubFlag = Flags.build<Org>({
char: 'v',
parse: async (input: string | undefined) => await getHubOrThrow(input),
default: async () => await getHubOrThrow(undefined),
defaultHelp: async () => (await getHubOrThrow(undefined))?.getUsername(),
default: async () => await getHubOrThrow(),
defaultHelp: async () => (await getHubOrThrow())?.getUsername(),
});
2 changes: 1 addition & 1 deletion src/flags/salesforceId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Messages, sfdc } from '@salesforce/core';
Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');

export interface IdFlagConfig extends Partial<Interfaces.OptionFlagProps> {
export interface IdFlagConfig extends Partial<Interfaces.OptionFlag<string>> {
/**
* Can specify if the version must be 15 or 18 characters long. Leave blank to allow either 15 or 18.
*/
Expand Down

0 comments on commit 0e65453

Please sign in to comment.