sf-raven 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,22 +6,6 @@ A plugin for the Salesforce CLI built by Tom Carman.
6
6
 
7
7
  [sf-raven](https://github.com/tomcarman/sf-raven) now replaces [sfdx-raven](https://github.com/tomcarman/sfdx-raven/).
8
8
 
9
- ## Why a new plugin?
10
-
11
- I originally built [sfdx-raven](https://github.com/tomcarman/sfdx-raven/) in 2020, but the Salesforce CLI landscape has changed a lot since then. Rather than attempting to [migrate the original plugin from sfdx to sf](https://github.com/salesforcecli/cli/wiki/Migrate-Plugins-Built-for-sfdx), it felt cleaner to start a new project and leverage the new architecture and scaffolding tools that come with the new sf cli.
12
-
13
- ## Improvements over sfdx-raven
14
-
15
- - Built on [sf not sfdx](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_move_to_sf_v2.htm).
16
- - Uses the latest version of [oclif](https://oclif.io/blog/2022/01/12/announcing-oclif-v2/).
17
- - Commands now follow the [sf command structure](https://github.com/salesforcecli/cli/wiki/Design-Guidelines#Command-Structure) guidelines - `<topic> <action> <resource | sub-action> [flags]`. For example:
18
- - `info:fields` becomes `object display fields`
19
- - `utils:event:listen` becomes `event subscribe`
20
- - Code now meets ESlint rules for TypeScript, including the Salesforce CLI Plugin custom rules.
21
- - The [Salesforce tooling / documentation](https://github.com/salesforcecli/cli/wiki/Code-Your-Plugin) for building custom plugins has matured a lot over the past couple years, which will make it easier to update the plugin going forward.
22
-
23
- More commands will be ported/added over time - see [Todo](#Todo).
24
-
25
9
  ## Command Quick Reference
26
10
 
27
11
  Full details, usage, examples etc are further down, or can be accessed via `--help` on the commands.
@@ -41,12 +25,12 @@ Full details, usage, examples etc are further down, or can be accessed via `--he
41
25
  #### sf raven event
42
26
 
43
27
  - [sf raven event subscribe](#sf-raven-event-subscribe)
44
- - Subscribe to Platform Events.
28
+ - Subscribe to Platform Events, streamed to your terminal.
45
29
 
46
30
  #### sf raven deploy
47
31
 
48
32
  - [sf raven deploy cancel](#sf-raven-deploy-cancel)
49
- - Cancel a pending or in-progress Salesforce deploy.
33
+ - Query an org for pending or in progress Salesforce deployments, and cancel them.
50
34
 
51
35
  #### sf raven query
52
36
 
@@ -56,9 +40,9 @@ Full details, usage, examples etc are further down, or can be accessed via `--he
56
40
  #### sf raven pull
57
41
 
58
42
  - [sf raven pull](#sf-raven-pull)
59
- - Pull local Salesforce metadata paths into the project.
43
+ - Update Salesforce metadata into the local project via a fuzzy finder.
60
44
  - [sf raven pull remote](#sf-raven-pull-remote)
61
- - Pull Salesforce metadata that exists in the org but not locally.
45
+ - Retrieve Salesforce metadata that exists in the org but not locally, via a fuzzy finder.
62
46
 
63
47
  <!-- #### sfdx:raven:utils
64
48
  * [sfdx raven:utils:deploy:branch2org](#sfdx-ravenutilsdeploybranch2org)
@@ -70,6 +54,9 @@ Full details, usage, examples etc are further down, or can be accessed via `--he
70
54
 
71
55
  ## Setup
72
56
 
57
+ ### Dependencies
58
+ * [fzf](https://github.com/junegunn/fzf) is required for the [sf raven pull](#sf-raven-pull) commands, and should be available on your path. (IMO they are probably the most useful commands in this plugin, so its worth setting up fzf if you don't have it.)
59
+
73
60
  ### Quick Install
74
61
 
75
62
  Assuming you already have the [sf cli](https://developer.salesforce.com/tools/salesforcecli) installed, the plugin can be installed by running:
@@ -96,36 +83,18 @@ The plugin can be updated to the latest version using
96
83
  - **macOS**
97
84
  - Plugin has been built on macOS and will always run on macOS
98
85
 
99
- <!-- * **Windows**
100
- * Work on Windows 10 1803+ (this is that latest build I have access to)
101
- * Known Issues:
102
- * Emoji will not work in cmd.exe / powershell - so you may seem some funny characters when running the plugin - this can be ignored. Emoji may work in Windows Terminal, but I have not managed to test yet
103
- * I don't think 'diff' is available on windows cli, so `sfdx:raven:utils:diff` is not likely to work.
104
-
105
- * **Linux**
106
- * Only tested on an Ubuntu installation on [WSL](https://docs.microsoft.com/en-us/windows/wsl/about), but should work. -->
107
-
108
- ## Todo
109
-
110
- - Migrate remaining commands from [sfdx-raven](https://github.com/tomcarman/sfdx-raven/)
111
- - sfdx raven:utils:deploy:branch2org
112
- - sfdx raven:utils:diff
113
- - sfdx raven:utils:dashboarduser:update - tbc
114
- - Get the sObject Type for a given Id
115
- - Get the picklist values for a given picklist
116
- - Clone a record
117
-
118
86
  ## sf raven object display fields
119
87
 
120
88
  Show field information for a given sObject.
121
89
 
122
90
  ```
123
91
  USAGE
124
- $ sf raven object display fields -o <value> -s <value> [--json]
92
+ $ sf raven object display fields -o <value> -s <value> [--json] [-c <value>]
125
93
 
126
94
  FLAGS
95
+ -c, --csv=<value> Path to write field information as CSV. When supplied, table output is suppressed.
127
96
  -o, --target-org=<value> (required) Login username or alias for the target org.
128
- -s, --sobject=<value> (required) The API name of the sObject that you want to view fields for.
97
+ -s, --sobject=<value> (required) The API name of the sObject that you want to view fields for. Use a comma-delimited list to query multiple objects.
129
98
 
130
99
  GLOBAL FLAGS
131
100
  --json Format output as json.
@@ -140,6 +109,10 @@ EXAMPLES
140
109
 
141
110
  $ sf raven object display fields --target-org dev --sobject My_Custom_Object__c
142
111
 
112
+ $ sf raven object display fields --target-org dev --sobject Account,Contact
113
+
114
+ $ sf raven object display fields --target-org dev --sobject Account --csv account-fields.csv
115
+
143
116
 
144
117
  OUTPUT
145
118
 
@@ -157,11 +130,12 @@ Show RecordType information for a given sObject.
157
130
 
158
131
  ```
159
132
  USAGE
160
- $ sf raven object display recordtypes -o <value> -s <value> [--json]
133
+ $ sf raven object display recordtypes -o <value> -s <value> [--json] [-c <value>]
161
134
 
162
135
  FLAGS
136
+ -c, --csv=<value> Path to write Record Type information as CSV. When supplied, table output is suppressed.
163
137
  -o, --target-org=<value> (required) Login username or alias for the target org.
164
- -s, --sobject=<value> (required) The API name of the sObject that you want to view Record Types for.
138
+ -s, --sobject=<value> (required) The API name of the sObject that you want to view Record Types for. Use a comma-delimited list to query multiple objects.
165
139
 
166
140
  GLOBAL FLAGS
167
141
  --json Format output as json.
@@ -176,6 +150,10 @@ EXAMPLES
176
150
 
177
151
  $ sf raven object display recordtypes --target-org dev --sobject My_Custom_Object__c
178
152
 
153
+ $ sf raven object display recordtypes --target-org dev --sobject Account,Opportunity
154
+
155
+ $ sf raven object display recordtypes --target-org dev --sobject Account --csv account-record-types.csv
156
+
179
157
 
180
158
  OUTPUT
181
159
 
@@ -188,7 +166,7 @@ Person Account PersonAccount 0124J000000YYYYDEF
188
166
 
189
167
  ## sf raven pull
190
168
 
191
- Pull Salesforce metadata into the local project.
169
+ Update Salesforce metadata into the local project via a fuzzy finder.
192
170
 
193
171
  ```
194
172
  USAGE
@@ -216,7 +194,7 @@ EXAMPLES
216
194
 
217
195
  ## sf raven pull remote
218
196
 
219
- Pull Salesforce metadata that exists in the org but not locally.
197
+ Retrieve Salesforce metadata that exists in the org but not locally, via a fuzzy finder.
220
198
 
221
199
  ```
222
200
  USAGE
@@ -334,7 +312,7 @@ Date Username Type Action
334
312
 
335
313
  ## sf raven event subscribe
336
314
 
337
- Subscribe to Platform Events.
315
+ Subscribe to Platform Events, streamed to your terminal.
338
316
 
339
317
  ```
340
318
  USAGE
@@ -9,6 +9,7 @@ export default class ObjectDisplayFields extends SfCommand<ObjectDisplayFieldsRe
9
9
  static readonly flags: {
10
10
  'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
11
11
  sobject: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ csv: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
13
  };
13
14
  run(): Promise<ObjectDisplayFieldsResult>;
14
15
  }
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { writeFileSync } from 'node:fs';
10
11
  import { SfCommand, Flags, Ux } from '@salesforce/sf-plugins-core';
11
12
  import { Messages } from '@salesforce/core';
12
13
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
@@ -14,31 +15,42 @@ const messages = Messages.loadMessages('sf-raven', 'raven.object.display.fields'
14
15
  class ObjectDisplayFields extends SfCommand {
15
16
  run() {
16
17
  return __awaiter(this, void 0, void 0, function* () {
17
- this.spinner.start('Loading...');
18
18
  const { flags } = yield this.parse(ObjectDisplayFields);
19
19
  const ux = new Ux({ jsonEnabled: this.jsonEnabled() });
20
20
  const org = flags['target-org'];
21
21
  const conn = org.getConnection();
22
- const query = `SELECT Label, QualifiedApiName, DataType FROM FieldDefinition WHERE EntityDefinition.QualifiedApiName = '${flags.sobject}' ORDER BY QualifiedApiName`;
23
- const result = (yield conn.query(query));
24
- this.spinner.stop();
25
- // Return table of fields
26
- ux.table(result.records, {
27
- label: {
28
- header: 'Name',
29
- get: (row) => row.Label,
30
- },
31
- qualifiedApiName: {
32
- header: 'Developer Name',
33
- get: (row) => row.QualifiedApiName,
34
- },
35
- dataType: {
36
- header: 'Type',
37
- get: (row) => row.DataType,
38
- },
39
- });
22
+ const sobjects = parseSobjects(flags.sobject);
23
+ const records = [];
24
+ this.spinner.start('Loading...');
25
+ try {
26
+ yield sobjects.reduce((previousQuery, sobject) => __awaiter(this, void 0, void 0, function* () {
27
+ yield previousQuery;
28
+ const query = `SELECT EntityDefinition.QualifiedApiName, Label, QualifiedApiName, DataType FROM FieldDefinition WHERE EntityDefinition.QualifiedApiName = '${sobject}' ORDER BY QualifiedApiName`;
29
+ const queryResult = (yield conn.query(query));
30
+ records.push(...queryResult.records);
31
+ }), Promise.resolve());
32
+ }
33
+ finally {
34
+ this.spinner.stop();
35
+ }
36
+ const result = {
37
+ totalSize: records.length,
38
+ done: true,
39
+ records,
40
+ };
41
+ const includeObjectColumn = sobjects.length > 1;
42
+ if (flags.csv) {
43
+ writeCsv(flags.csv, result.records, includeObjectColumn);
44
+ ux.log(messages.getMessage('info.csvWritten', [result.records.length.toString(), flags.csv]));
45
+ }
46
+ else {
47
+ // Return table of fields
48
+ ux.table(result.records, getTableColumns(includeObjectColumn));
49
+ }
40
50
  // Return url
41
- ux.log(`\n${conn.instanceUrl}/lightning/setup/ObjectManager/${flags.sobject}/FieldsAndRelationships/view`);
51
+ if (sobjects.length === 1) {
52
+ ux.log(`\n${conn.instanceUrl}/lightning/setup/ObjectManager/${sobjects[0]}/FieldsAndRelationships/view`);
53
+ }
42
54
  // Return an object to be displayed with --json
43
55
  return result;
44
56
  });
@@ -58,6 +70,56 @@ ObjectDisplayFields.flags = {
58
70
  char: 's',
59
71
  required: true,
60
72
  }),
73
+ csv: Flags.file({
74
+ summary: messages.getMessage('flags.csv.summary'),
75
+ char: 'c',
76
+ }),
61
77
  };
62
78
  export default ObjectDisplayFields;
79
+ const parseSobjects = (sobjectFlag) => {
80
+ const sobjects = sobjectFlag
81
+ .split(',')
82
+ .map((sobject) => sobject.trim())
83
+ .filter((sobject) => sobject.length > 0);
84
+ return Array.from(new Set(sobjects));
85
+ };
86
+ const getTableColumns = (includeObjectColumn) => (Object.assign(Object.assign({}, (includeObjectColumn
87
+ ? {
88
+ object: {
89
+ header: 'Object',
90
+ get: (row) => row.EntityDefinition.QualifiedApiName,
91
+ },
92
+ }
93
+ : {})), { label: {
94
+ header: 'Name',
95
+ get: (row) => row.Label,
96
+ }, qualifiedApiName: {
97
+ header: 'Developer Name',
98
+ get: (row) => row.QualifiedApiName,
99
+ }, dataType: {
100
+ header: 'Type',
101
+ get: (row) => row.DataType,
102
+ } }));
103
+ const writeCsv = (filePath, records, includeObjectColumn) => {
104
+ const columns = includeObjectColumn ? ['Object', 'Name', 'Developer Name', 'Type'] : ['Name', 'Developer Name', 'Type'];
105
+ const rows = [
106
+ columns.map(escapeCsvValue).join(','),
107
+ ...records.map((record) => (includeObjectColumn
108
+ ? [record.EntityDefinition.QualifiedApiName, record.Label, record.QualifiedApiName, record.DataType]
109
+ : [record.Label, record.QualifiedApiName, record.DataType])
110
+ .map(escapeCsvValue)
111
+ .join(',')),
112
+ ];
113
+ writeFileSync(filePath, `${rows.join('\n')}\n`, 'utf8');
114
+ };
115
+ const escapeCsvValue = (value) => {
116
+ if (value == null) {
117
+ return '';
118
+ }
119
+ const stringValue = String(value);
120
+ if (/[",\n\r]/.test(stringValue)) {
121
+ return `"${stringValue.replace(/"/g, '""')}"`;
122
+ }
123
+ return stringValue;
124
+ };
63
125
  //# sourceMappingURL=fields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../src/commands/raven/object/display/fields.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,6BAA6B,CAAC,CAAC;AAMlF,MAAqB,mBAAoB,SAAQ,SAAoC;IAkBtE,GAAG;;YACd,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YAgBjC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;YACxD,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YAEvD,MAAM,GAAG,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;YAChC,MAAM,IAAI,GAAG,GAAG,CAAC,aAAa,EAAE,CAAC;YACjC,MAAM,KAAK,GAAG,4GAA4G,KAAK,CAAC,OAAO,6BAA6B,CAAC;YACrK,MAAM,MAAM,GAAG,CAAC,MAA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AAc,EAAU,EAAE;IAChD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAElC,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;IAChD,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC"}
@@ -9,6 +9,7 @@ export default class ObjectDisplayRecordtypes extends SfCommand<ObjectDisplayRec
9
9
  static readonly flags: {
10
10
  'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
11
11
  sobject: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ csv: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
13
  };
13
14
  run(): Promise<ObjectDisplayRecordtypesResult>;
14
15
  }
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { writeFileSync } from 'node:fs';
10
11
  import { SfCommand, Flags, Ux } from '@salesforce/sf-plugins-core';
11
12
  import { Messages } from '@salesforce/core';
12
13
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
@@ -14,31 +15,42 @@ const messages = Messages.loadMessages('sf-raven', 'raven.object.display.recordt
14
15
  class ObjectDisplayRecordtypes extends SfCommand {
15
16
  run() {
16
17
  return __awaiter(this, void 0, void 0, function* () {
17
- this.spinner.start('Loading...');
18
18
  const { flags } = yield this.parse(ObjectDisplayRecordtypes);
19
19
  const ux = new Ux({ jsonEnabled: this.jsonEnabled() });
20
20
  const org = flags['target-org'];
21
21
  const conn = org.getConnection();
22
- const query = `SELECT Name, DeveloperName, Id FROM RecordType WHERE SObjectType = '${flags.sobject}'`;
23
- const result = (yield conn.query(query));
24
- this.spinner.stop();
25
- // Return table of fields
26
- ux.table(result.records, {
27
- label: {
28
- header: 'Name',
29
- get: (row) => row.Name,
30
- },
31
- qualifiedApiName: {
32
- header: 'Developer Name',
33
- get: (row) => row.DeveloperName,
34
- },
35
- dataType: {
36
- header: 'Id',
37
- get: (row) => row.Id,
38
- },
39
- });
22
+ const sobjects = parseSobjects(flags.sobject);
23
+ const records = [];
24
+ this.spinner.start('Loading...');
25
+ try {
26
+ yield sobjects.reduce((previousQuery, sobject) => __awaiter(this, void 0, void 0, function* () {
27
+ yield previousQuery;
28
+ const query = `SELECT SObjectType, Name, DeveloperName, Id FROM RecordType WHERE SObjectType = '${sobject}' ORDER BY DeveloperName`;
29
+ const queryResult = (yield conn.query(query));
30
+ records.push(...queryResult.records.map((record) => (Object.assign(Object.assign({}, record), { SObjectType: sobject }))));
31
+ }), Promise.resolve());
32
+ }
33
+ finally {
34
+ this.spinner.stop();
35
+ }
36
+ const result = {
37
+ totalSize: records.length,
38
+ done: true,
39
+ records,
40
+ };
41
+ const includeObjectColumn = sobjects.length > 1;
42
+ if (flags.csv) {
43
+ writeCsv(flags.csv, result.records, includeObjectColumn);
44
+ ux.log(messages.getMessage('info.csvWritten', [result.records.length.toString(), flags.csv]));
45
+ }
46
+ else {
47
+ // Return table of fields
48
+ ux.table(result.records, getTableColumns(includeObjectColumn));
49
+ }
40
50
  // Return url
41
- ux.log(`\n${conn.instanceUrl}/lightning/setup/ObjectManager/${flags.sobject}/RecordTypes/view`);
51
+ if (sobjects.length === 1) {
52
+ ux.log(`\n${conn.instanceUrl}/lightning/setup/ObjectManager/${sobjects[0]}/RecordTypes/view`);
53
+ }
42
54
  // Return an object to be displayed with --json
43
55
  return result;
44
56
  });
@@ -58,6 +70,56 @@ ObjectDisplayRecordtypes.flags = {
58
70
  char: 's',
59
71
  required: true,
60
72
  }),
73
+ csv: Flags.file({
74
+ summary: messages.getMessage('flags.csv.summary'),
75
+ char: 'c',
76
+ }),
61
77
  };
62
78
  export default ObjectDisplayRecordtypes;
79
+ const parseSobjects = (sobjectFlag) => {
80
+ const sobjects = sobjectFlag
81
+ .split(',')
82
+ .map((sobject) => sobject.trim())
83
+ .filter((sobject) => sobject.length > 0);
84
+ return Array.from(new Set(sobjects));
85
+ };
86
+ const getTableColumns = (includeObjectColumn) => (Object.assign(Object.assign({}, (includeObjectColumn
87
+ ? {
88
+ object: {
89
+ header: 'Object',
90
+ get: (row) => row.SObjectType,
91
+ },
92
+ }
93
+ : {})), { label: {
94
+ header: 'Name',
95
+ get: (row) => row.Name,
96
+ }, qualifiedApiName: {
97
+ header: 'Developer Name',
98
+ get: (row) => row.DeveloperName,
99
+ }, dataType: {
100
+ header: 'Id',
101
+ get: (row) => row.Id,
102
+ } }));
103
+ const writeCsv = (filePath, records, includeObjectColumn) => {
104
+ const columns = includeObjectColumn ? ['Object', 'Name', 'Developer Name', 'Id'] : ['Name', 'Developer Name', 'Id'];
105
+ const rows = [
106
+ columns.map(escapeCsvValue).join(','),
107
+ ...records.map((record) => (includeObjectColumn
108
+ ? [record.SObjectType, record.Name, record.DeveloperName, record.Id]
109
+ : [record.Name, record.DeveloperName, record.Id])
110
+ .map(escapeCsvValue)
111
+ .join(',')),
112
+ ];
113
+ writeFileSync(filePath, `${rows.join('\n')}\n`, 'utf8');
114
+ };
115
+ const escapeCsvValue = (value) => {
116
+ if (value == null) {
117
+ return '';
118
+ }
119
+ const stringValue = String(value);
120
+ if (/[",\n\r]/.test(stringValue)) {
121
+ return `"${stringValue.replace(/"/g, '""')}"`;
122
+ }
123
+ return stringValue;
124
+ };
63
125
  //# sourceMappingURL=recordtypes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"recordtypes.js","sourceRoot":"","sources":["../../../../../src/commands/raven/object/display/recordtypes.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EA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.summary
14
14
 
15
- The API name of the sObject that you want to view fields for.
15
+ The API name of the sObject that you want to view fields for. Use a comma-delimited list to query multiple objects.
16
+
17
+ # flags.csv.summary
18
+
19
+ Path to write field information as CSV. When supplied, table output is suppressed.
20
+
21
+ # info.csvWritten
22
+
23
+ Wrote %s fields to %s.
16
24
 
17
25
  # examples
18
26
 
19
27
  - <%= config.bin %> <%= command.id %> --target-org dev --sobject Account
20
28
 
21
29
  - <%= config.bin %> <%= command.id %> --target-org dev --sobject My_Custom_Object\_\_c
30
+
31
+ - <%= config.bin %> <%= command.id %> --target-org dev --sobject Account,Contact
32
+
33
+ - <%= config.bin %> <%= command.id %> --target-org dev --sobject Account --csv account-fields.csv
@@ -12,10 +12,22 @@ Login username or alias for the target org.
12
12
 
13
13
  # flags.sobject.summary
14
14
 
15
- The API name of the sObject that you want to view Record Types for.
15
+ The API name of the sObject that you want to view Record Types for. Use a comma-delimited list to query multiple objects.
16
+
17
+ # flags.csv.summary
18
+
19
+ Path to write Record Type information as CSV. When supplied, table output is suppressed.
20
+
21
+ # info.csvWritten
22
+
23
+ Wrote %s Record Types to %s.
16
24
 
17
25
  # examples
18
26
 
19
27
  - <%= config.bin %> <%= command.id %> --target-org dev --sobject Account
20
28
 
21
29
  - <%= config.bin %> <%= command.id %> --target-org dev --sobject My_Custom_Object\_\_c
30
+
31
+ - <%= config.bin %> <%= command.id %> --target-org dev --sobject Account,Opportunity
32
+
33
+ - <%= config.bin %> <%= command.id %> --target-org dev --sobject Account --csv account-record-types.csv
@@ -413,7 +413,9 @@
413
413
  "description": "FieldDefinition metadata is queried for the given sObject. The field Labels, API names, and Type are displayed.",
414
414
  "examples": [
415
415
  "<%= config.bin %> <%= command.id %> --target-org dev --sobject Account",
416
- "<%= config.bin %> <%= command.id %> --target-org dev --sobject My_Custom_Object\\_\\_c"
416
+ "<%= config.bin %> <%= command.id %> --target-org dev --sobject My_Custom_Object\\_\\_c",
417
+ "<%= config.bin %> <%= command.id %> --target-org dev --sobject Account,Contact",
418
+ "<%= config.bin %> <%= command.id %> --target-org dev --sobject Account --csv account-fields.csv"
417
419
  ],
418
420
  "flags": {
419
421
  "json": {
@@ -445,7 +447,15 @@
445
447
  "char": "s",
446
448
  "name": "sobject",
447
449
  "required": true,
448
- "summary": "The API name of the sObject that you want to view fields for.",
450
+ "summary": "The API name of the sObject that you want to view fields for. Use a comma-delimited list to query multiple objects.",
451
+ "hasDynamicHelp": false,
452
+ "multiple": false,
453
+ "type": "option"
454
+ },
455
+ "csv": {
456
+ "char": "c",
457
+ "name": "csv",
458
+ "summary": "Path to write field information as CSV. When supplied, table output is suppressed.",
449
459
  "hasDynamicHelp": false,
450
460
  "multiple": false,
451
461
  "type": "option"
@@ -476,7 +486,9 @@
476
486
  "description": "RecordType metadata is queried for the given sObject. The RecordType Name, DeveloperName, and Id are displayed.",
477
487
  "examples": [
478
488
  "<%= config.bin %> <%= command.id %> --target-org dev --sobject Account",
479
- "<%= config.bin %> <%= command.id %> --target-org dev --sobject My_Custom_Object\\_\\_c"
489
+ "<%= config.bin %> <%= command.id %> --target-org dev --sobject My_Custom_Object\\_\\_c",
490
+ "<%= config.bin %> <%= command.id %> --target-org dev --sobject Account,Opportunity",
491
+ "<%= config.bin %> <%= command.id %> --target-org dev --sobject Account --csv account-record-types.csv"
480
492
  ],
481
493
  "flags": {
482
494
  "json": {
@@ -508,7 +520,15 @@
508
520
  "char": "s",
509
521
  "name": "sobject",
510
522
  "required": true,
511
- "summary": "The API name of the sObject that you want to view Record Types for.",
523
+ "summary": "The API name of the sObject that you want to view Record Types for. Use a comma-delimited list to query multiple objects.",
524
+ "hasDynamicHelp": false,
525
+ "multiple": false,
526
+ "type": "option"
527
+ },
528
+ "csv": {
529
+ "char": "c",
530
+ "name": "csv",
531
+ "summary": "Path to write Record Type information as CSV. When supplied, table output is suppressed.",
512
532
  "hasDynamicHelp": false,
513
533
  "multiple": false,
514
534
  "type": "option"
@@ -534,5 +554,5 @@
534
554
  ]
535
555
  }
536
556
  },
537
- "version": "1.2.0"
557
+ "version": "1.2.1"
538
558
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sf-raven",
3
3
  "description": "A custom sf plugin built by @tomcarman",
4
- "version": "1.2.0",
4
+ "version": "1.2.1",
5
5
  "dependencies": {
6
6
  "@inquirer/select": "^2.4.2",
7
7
  "@oclif/core": "^4.0.14",