generated from salesforcecli/plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdecouple.ts
47 lines (39 loc) · 1.74 KB
/
decouple.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
36
37
38
39
40
41
42
43
44
45
46
47
/*
* Copyright (c) 2021, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import { flags, SfdxCommand } from '@salesforce/command';
import { Messages, Org } from '@salesforce/core';
import Folder from '../../../lib/analytics/app/folder';
Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/analytics', 'app');
export default class Decouple extends SfdxCommand {
public static description = messages.getMessage('decoupleCommandDescription');
public static longDescription = messages.getMessage('decoupleCommandLongDescription');
public static examples = ['$ sfdx analytics:app:decouple -f folderId -t templateId'];
protected static flagsConfig = {
folderid: flags.id({
char: 'f',
required: true,
description: messages.getMessage('folderidFlagDescription'),
longDescription: messages.getMessage('folderidFlagLongDescription')
}),
templateid: flags.id({
char: 't',
required: true,
description: messages.getMessage('templateidFlagDescription'),
longDescription: messages.getMessage('templateidFlagLongDescription')
})
};
protected static requiresUsername = true;
protected static requiresProject = false;
public async run() {
const folder = new Folder(this.org as Org);
const folderId = await folder.decouple(this.flags.folderid as string, this.flags.templateid as string);
// If error occurs here fails out in the decouple call and reports back, otherwise success
this.ux.log(messages.getMessage('decoupleSuccess', [folderId, this.flags.templateid]));
return folderId;
}
}