generated from salesforcecli/plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.ts
53 lines (44 loc) · 1.67 KB
/
list.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
48
49
50
51
52
53
/*
* 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 { SfdxCommand } from '@salesforce/command';
import { Messages, Org } from '@salesforce/core';
import AutoInstall from '../../../lib/analytics/autoinstall/autoinstall';
Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/analytics', 'autoinstall');
export default class List extends SfdxCommand {
public static description = messages.getMessage('listCommandDescription');
public static longDescription = messages.getMessage('listCommandLongDescription');
public static examples = ['$ sfdx analytics:autoinstall:list'];
protected static flagsConfig = {};
protected static requiresUsername = true;
protected static requiresProject = false;
protected static tableColumnData = [
'id',
'requestType',
'requestName',
'requestStatus',
'templateApiName',
'folderId',
'folderLabel'
];
public async run() {
const autoinstall = new AutoInstall(this.org as Org);
const autoinstalls = ((await autoinstall.list()) || []).map(request => ({
id: request.id,
requestType: request.requestType,
requestName: request.requestName,
requestStatus: request.requestStatus,
templateApiName: request.templateApiName,
folderId: request.folderId,
folderLabel: request.folderLabel
}));
if (autoinstalls.length) {
this.ux.styledHeader(messages.getMessage('autoinstallsFound', [autoinstalls.length]));
}
return autoinstalls;
}
}