Skip to content

Commit

Permalink
fix(flags): remove unused orgFlags
Browse files Browse the repository at this point in the history
sfpowerscripts uses old style sfdx flags for now, and the this file is not  required
  • Loading branch information
azlam-abdulsalam committed Aug 7, 2023
1 parent 41cdf44 commit 2442072
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 256 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class Promote extends SfpowerscriptsCommand {
description: messages.getMessage('publishPromotedOnlyFlagDescription'),
dependsOn: ['devhubalias'],
}),
'devhubalias':optionalDevHubFlag,
'devhubalias':optionalDevHubFlag,
scriptpath: Flags.file({
char: 'f',
description: messages.getMessage('scriptPathFlagDescription'),
Expand Down
236 changes: 0 additions & 236 deletions packages/sfpowerscripts-cli/src/flags/orgFlags.ts

This file was deleted.

30 changes: 11 additions & 19 deletions packages/sfpowerscripts-cli/src/flags/sfdxflags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import { Flags } from '@oclif/core';
import { Lifecycle, Messages, Org, OrgConfigProperties } from '@salesforce/core';
import { orgApiVersionFlag } from './orgApiVersion';
import { getHubOrThrow, getOrgOrThrow, maybeGetHub, maybeGetOrg, optionalHubFlag, optionalOrgFlag, requiredHubFlag, requiredOrgFlag } from './orgFlags';
import { AliasAccessor } from '@salesforce/core/lib/stateAggregator';

/**
Expand All @@ -27,13 +26,7 @@ export const orgApiVersionFlagSfdxStyle = orgApiVersionFlag({

Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@dxatscale/sfpowerscripts', '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
*
*
*/

export const loglevel = Flags.string({
description: 'logging level for this command invocation',
default: 'info',
Expand Down Expand Up @@ -89,17 +82,16 @@ export const requiredUserNameFlag = userNameFlag({
const devhubFlag = Flags.custom({
char: 'v',
summary: messages.getMessage('flags.targetDevHubOrg.summary'),
parse: async (input: string | undefined) => (await getHubOrThrow(input)).getUsername(),
default: async () => (await getHubOrThrow()).getUsername(),
defaultHelp: async (context, isWritingManifest) => {
if (isWritingManifest) {
return undefined;
}
if (context.options instanceof Org) {
const org = context.options as Org;
return org.getUsername();
}
return (await maybeGetHub())?.getUsername();
parse: async (input: string | undefined) => {
let aliasAccessor = (await AliasAccessor.create());
let resolvedAliasOrUserName;
if(aliasAccessor.resolveAlias(input))
resolvedAliasOrUserName=aliasAccessor.resolveAlias(input);
else
resolvedAliasOrUserName=aliasAccessor.resolveUsername(input);
//Check if its devhub
const org = await Org.create({ aliasOrUsername: resolvedAliasOrUserName, isDevHub: true });
return resolvedAliasOrUserName;
},
});

Expand Down

0 comments on commit 2442072

Please sign in to comment.