-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathxml.ts
35 lines (25 loc) · 1.37 KB
/
xml.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { flags, SfdxCommand } from '@salesforce/command';
import ucc = require('../../../../shared/unzipConvertClean');
const tmpDir = 'mdapiout';
export default class XML extends SfdxCommand {
public static description = 'DEPRECATED. Use force:source:retrieve these days! gets metadata form an org based on a local package.xml, converts, and merges it into the local source';
public static examples = [
`sfdx shane:mdapi:package:xml -p someFolder/package.xml -u someOrg
// pulls a metadat from the org and converts/merges it into force-app
`,
`sfdx shane:mdapi:package:xml -p someFolder/package.xml -u someOrg -t someDir
// pulls a package from the org and converts/merges it into /someDir
`
];
protected static requiresUsername = true;
protected static flagsConfig = {
xmlpath: flags.filepath({required: true, char: 'p', description: 'the location of the package.xml you want to use' }),
target: flags.directory({char: 't', default: 'force-app', description: 'where to convert the result to...defaults to force-app' })
};
protected static requiresProject = true;
// tslint:disable-next-line:no-any
public async run(): Promise<any> {
const retrieveCommand = `sfdx force:mdapi:retrieve -s -k "${this.flags.xmlpath}" -u ${this.org.getUsername()} -r ./${tmpDir} -w 30`;
await ucc.retrieveUnzipConvertClean(tmpDir, retrieveCommand, this.flags.target);
}
}