Skip to content

Commit

Permalink
feat: friendly default help for org flags
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Mar 3, 2022
1 parent c1f95fc commit f4d55b3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"/messages"
],
"dependencies": {
"@oclif/core": "^1.5.0",
"@oclif/core": "^1.5.1",
"@salesforce/core": "^3.7.6",
"@salesforce/kit": "^1.5.17",
"@salesforce/ts-types": "^1.5.20",
Expand Down
3 changes: 3 additions & 0 deletions src/flags/orgFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +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(),
});

/**
Expand All @@ -83,6 +84,7 @@ 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(),
});

/**
Expand All @@ -108,4 +110,5 @@ 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(),
});
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,10 @@
widest-line "^3.1.0"
wrap-ansi "^7.0.0"

"@oclif/core@^1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-1.5.0.tgz#0cbbda158baca0453c510a8088ca9dd75ca2ea24"
integrity sha512-dVFdPijU4fwTbTV0SodCLxOTF4EcKTa9YvIKAHz/ZhJGxbkCJofcJZV/htCgrS7hNbp3jvoO2pYHAUbJEZ3qmA==
"@oclif/core@^1.5.1":
version "1.5.1"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-1.5.1.tgz#29969ebd244d1bbf0d98418a3c3620909afa4367"
integrity sha512-dlJpww5UAHv46Z7p37ytQIKDkwOmA3uQY6ChPRY6Q9/YfDD4H0z3JfA+lfVfwHkZcIpiq9XsCkhCmBw7Uoh6Iw==
dependencies:
"@oclif/linewrap" "^1.0.0"
"@oclif/screen" "^3.0.2"
Expand Down

0 comments on commit f4d55b3

Please sign in to comment.