diff --git a/src/commands/api-mesh/__tests__/get.test.js b/src/commands/api-mesh/__tests__/get.test.js index 76f2f67a..ed2461c2 100644 --- a/src/commands/api-mesh/__tests__/get.test.js +++ b/src/commands/api-mesh/__tests__/get.test.js @@ -96,6 +96,13 @@ describe('get command tests', () => { "parse": [Function], "type": "boolean", }, + "json": { + "allowNo": false, + "default": false, + "description": "Output JSON", + "parse": [Function], + "type": "boolean", + }, } `); expect(GetCommand.aliases).toMatchInlineSnapshot(`[]`); @@ -182,6 +189,7 @@ describe('get command tests', () => { expect(initSdk).toHaveBeenCalledWith({ ignoreCache: true, + verbose: true, }); expect(initRequestId).toHaveBeenCalled(); expect(runResult).toEqual({ meshId: 'dummy_meshId', mesh: mockGetMeshConfig }); diff --git a/src/commands/api-mesh/get.js b/src/commands/api-mesh/get.js index f717c001..a315f149 100644 --- a/src/commands/api-mesh/get.js +++ b/src/commands/api-mesh/get.js @@ -23,7 +23,7 @@ class GetCommand extends Command { static args = [{ name: 'file' }]; static flags = { ignoreCache: ignoreCacheFlag, - json: jsonFlag + json: jsonFlag, }; async run() { @@ -34,11 +34,11 @@ class GetCommand extends Command { const { args, flags } = await this.parse(GetCommand); const ignoreCache = await flags.ignoreCache; - const json = await flags.json + const json = await flags.json; const { imsOrgId, projectId, workspaceId } = await initSdk({ ignoreCache, - verbose: !json + verbose: !json, }); let meshId = null; @@ -56,8 +56,8 @@ class GetCommand extends Command { const mesh = await getMesh(imsOrgId, projectId, workspaceId, meshId); if (mesh) { - const jsonString = JSON.stringify(mesh, null, 2) - this.log(json ? jsonString : `Successfully retrieved mesh ${jsonString}`) + const jsonString = JSON.stringify(mesh, null, 2); + this.log(json ? '' : 'Successfully retrieved mesh %s', jsonString); if (args.file) { try {