generated from salesforcecli/plugin-template-sf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.ts
32 lines (27 loc) · 1.29 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
/*
* Copyright (c) 2022, 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 { StateAggregator, Messages } from '@salesforce/core';
import { loglevel } from '@salesforce/sf-plugins-core';
import { AliasCommand, AliasResults } from '../../alias.js';
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@salesforce/plugin-settings', 'alias.list');
export default class AliasList extends AliasCommand<AliasResults> {
public static summary = messages.getMessage('summary');
public static description = messages.getMessage('description');
public static examples = messages.getMessages('examples');
public static readonly aliases = ['force:alias:list'];
public static readonly deprecateAliases = true;
public static readonly flags = { loglevel };
public async run(): Promise<AliasResults> {
await this.parse(AliasList);
const stateAggregator = await StateAggregator.getInstance();
const aliases = stateAggregator.aliases.getAll();
const results = Object.entries(aliases).map(([alias, value]) => ({ alias, value }));
this.output('Alias List', results);
return results;
}
}