-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: remove -o conflict, add short char UTs, add short chars to NUTs #821
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,17 @@ import { | |
MetadataApiDeployStatus, | ||
RequestStatus, | ||
} from '@salesforce/source-deploy-retrieve'; | ||
import { Connection, Messages, Org, PollingClient, SfdxPropertyKeys, SfError, StatusResult } from '@salesforce/core'; | ||
import { | ||
ConfigAggregator, | ||
Connection, | ||
Messages, | ||
Org, | ||
PollingClient, | ||
SfdxPropertyKeys, | ||
SfError, | ||
StateAggregator, | ||
StatusResult, | ||
} from '@salesforce/core'; | ||
import { AnyJson, getBoolean, isString } from '@salesforce/ts-types'; | ||
import { Duration, once, ensureArray } from '@salesforce/kit'; | ||
import { | ||
|
@@ -25,6 +35,7 @@ import { | |
DefaultReportOptions, | ||
JUnitReporter, | ||
} from '@salesforce/apex-node'; | ||
import { Flags } from '@salesforce/sf-plugins-core'; | ||
import { SourceCommand } from './sourceCommand'; | ||
import { DeployData, Stash } from './stash'; | ||
import { transformCoverageToApexCoverage, transformDeployTestsResultsToTestResult } from './coverageUtils'; | ||
|
@@ -53,6 +64,7 @@ export abstract class DeployCommand extends SourceCommand { | |
const stashKey = Stash.getKey(this.id); | ||
Stash.set(stashKey, { jobid: id }); | ||
}); | ||
|
||
/** | ||
* Request a report of an in-progress or completed deployment. | ||
* | ||
|
@@ -259,3 +271,26 @@ export const getCoverageFormattersOptions = (formatters: string[] = []): Coverag | |
reportOptions, | ||
}; | ||
}; | ||
|
||
export const targetUsernameFlag = Flags.string({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having target-org with short char other than 'o' break sf guidelines. I ran into short char collision in plugin-user and to avoid the collision we ended up retaining the old commands that used the |
||
required: true, | ||
char: 'u', | ||
deprecateAliases: true, | ||
// DO NOT alias to 'o', it will conflict with '--ignoreerrors' | ||
aliases: ['targetusername', 'u'], | ||
summary: messages.getMessage('flags.targetusername.summary'), | ||
parse: async (input: string | undefined) => resolveUsername(input), | ||
default: async () => resolveUsername(), | ||
defaultHelp: async () => resolveUsername(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this correct for defaultHelp? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is similar to what we did in plugin-org There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This form can leak customer data into the manifest. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
}); | ||
|
||
export const resolveUsername = async (usernameOrAlias?: string): Promise<string> => { | ||
const stateAggregator = await StateAggregator.getInstance(); | ||
// we have a value, but don't know if it's a username or an alias | ||
if (usernameOrAlias) return stateAggregator.aliases.resolveUsername(usernameOrAlias); | ||
// we didn't get a value, so let's see if the config has a default target org | ||
const configAggregator = await ConfigAggregator.create(); | ||
const defaultUsernameOrAlias: string = configAggregator.getPropertyValue('target-org'); | ||
if (defaultUsernameOrAlias) return stateAggregator.aliases.resolveUsername(defaultUsernameOrAlias); | ||
throw new SfError(messages.getMessage('missingUsername'), 'MissingUsernameError'); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this comment mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leftover - will remove