Skip to content

Commit

Permalink
feat: add MultiStageOutput
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Aug 16, 2024
1 parent 83f6799 commit 39ac67e
Show file tree
Hide file tree
Showing 5 changed files with 276 additions and 34 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"@inquirer/confirm": "^3.1.22",
"@inquirer/password": "^2.1.22",
"@oclif/core": "^4.0.15",
"@oclif/multi-stage-output": "^0.2.1",
"@salesforce/core": "^8.2.7",
"@salesforce/kit": "^3.2.1",
"@salesforce/ts-types": "^2.0.12",
Expand Down
1 change: 1 addition & 0 deletions src/exported.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
export { toHelpSection, parseVarArgs } from './util.js';
export { Progress } from './ux/progress.js';
export { Spinner } from './ux/spinner.js';
export { MultiStageOutput } from './ux/multiStageOutput.js';
export { Ux } from './ux/ux.js';
export { StandardColors } from './ux/standardColors.js';

Expand Down
18 changes: 18 additions & 0 deletions src/ux/multiStageOutput.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2024, 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 { MultiStageOutput as OclifMultiStageOutput, MultiStageOutputOptions } from '@oclif/multi-stage-output';

/**
* This class is a light wrapper around MultiStageOutput that allows us to
* automatically suppress any actions if `--json` flag is present.
*/
export class MultiStageOutput<T extends Record<string, unknown>> extends OclifMultiStageOutput<T> {
public constructor(opts: MultiStageOutputOptions<T> & { outputEnabled: boolean }) {
if (opts.outputEnabled) super(opts);
}
}
2 changes: 1 addition & 1 deletion src/ux/ux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import ansis from 'ansis';
import { ux } from '@oclif/core';
import { ux } from '@oclif/core/ux';
import { AnyJson } from '@salesforce/ts-types';
import terminalLink from 'terminal-link';
import { UxBase } from './base.js';
Expand Down
Loading

0 comments on commit 39ac67e

Please sign in to comment.