diff --git a/command-snapshot.json b/command-snapshot.json index 5682cae7..716ae9d8 100644 --- a/command-snapshot.json +++ b/command-snapshot.json @@ -184,9 +184,9 @@ { "alias": [], "command": "data:search", - "flagAliases": ["apiversion", "resultformat", "targetusername", "u"], + "flagAliases": [], "flagChars": ["f", "o", "q", "r"], - "flags": ["api-version", "file", "flags-dir", "json", "loglevel", "query", "result-format", "target-org"], + "flags": ["api-version", "file", "flags-dir", "json", "query", "result-format", "target-org"], "plugin": "@salesforce/plugin-data" }, { diff --git a/src/commands/data/search.ts b/src/commands/data/search.ts index ca48bb1e..29efbe01 100644 --- a/src/commands/data/search.ts +++ b/src/commands/data/search.ts @@ -9,8 +9,8 @@ import fs from 'node:fs'; import { Messages } from '@salesforce/core'; import type { SearchResult } from '@jsforce/jsforce-node'; import { SfCommand, Flags } from '@salesforce/sf-plugins-core'; -import { orgFlags, resultFormatFlag } from '../../flags.js'; import { displaySearchResults } from '../../searchUtils.js'; +import { FormatTypes, formatTypes } from '../../reporters/query/reporters.js'; Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); const messages = Messages.loadMessages('@salesforce/plugin-data', 'data.search'); @@ -21,7 +21,8 @@ export class DataSearchCommand extends SfCommand { public static readonly examples = messages.getMessages('examples'); public static readonly flags = { - ...orgFlags, + 'target-org': Flags.requiredOrg(), + 'api-version': Flags.orgApiVersion(), query: Flags.string({ char: 'q', summary: messages.getMessage('flags.query.summary'), @@ -33,10 +34,13 @@ export class DataSearchCommand extends SfCommand { summary: messages.getMessage('flags.file.summary'), exactlyOne: ['query', 'file'], }), - 'result-format': resultFormatFlag({ + 'result-format': Flags.custom({ + char: 'r', summary: messages.getMessage('flags.result-format.summary'), + options: formatTypes, + default: 'human', exclusive: ['json'], - }), + })(), }; public async run(): Promise { diff --git a/test/commands/data/create/file.nut.ts b/test/commands/data/create/file.nut.ts index 4f5ff956..a4ab47b1 100644 --- a/test/commands/data/create/file.nut.ts +++ b/test/commands/data/create/file.nut.ts @@ -25,6 +25,7 @@ describe('data create file NUTs', () => { // create one record in the org that we'll use to attach stuff to acctId = execCmd('data:create:record -s Account -v "Name=TestAccount" --json', { ensureExitCode: 0, + cli: 'sf' }).jsonOutput?.result.id; expect(acctId).to.be.a('string'); // make a file we can upload