Skip to content

Commit

Permalink
feat: spinners while waiting on pull
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Sep 14, 2021
1 parent 0f3f11e commit dfe5aea
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/commands/force/source/pull.ts
Expand Up @@ -38,13 +38,15 @@ export default class SourcePull extends SfdxCommand {

// eslint-disable-next-line @typescript-eslint/no-explicit-any
public async run(): Promise<any> {
this.ux.startSpinner('Loading source tracking information');
const tracking = await SourceTracking.create({
org: this.org,
project: this.project,
apiVersion: this.flags.apiversion as string,
});

await tracking.ensureRemoteTracking(true);
this.ux.setSpinnerStatus('Checking for conflicts');

if (!this.flags.forceoverwrite) {
const conflicts = await tracking.getConflicts();
Expand All @@ -53,11 +55,11 @@ export default class SourcePull extends SfdxCommand {
throw new Error(messages.getMessage('sourceConflictDetected'));
}
}
this.ux.setSpinnerStatus('Retrieving metadata from the org');

const retrieveResult = await tracking.retrieveRemoteChanges({ wait: this.flags.wait as Duration });

this.ux.stopSpinner();
if (!this.flags.json) {
this.ux.logJson(retrieveResult);
this.ux.table(retrieveResult, {
columns: [
{ label: 'STATE', key: 'state' },
Expand All @@ -67,11 +69,6 @@ export default class SourcePull extends SfdxCommand {
],
});
}
return retrieveResult.map((fileResponse) => ({
state: fileResponse.state,
fullName: fileResponse.fullName,
type: fileResponse.type,
filePath: fileResponse.filePath,
}));
return retrieveResult.map(({ state, fullName, type, filePath }) => ({ state, fullName, type, filePath }));
}
}

0 comments on commit dfe5aea

Please sign in to comment.