Skip to content

Commit

Permalink
Makes spinner stream configurable by errorOutput. Closes #5521
Browse files Browse the repository at this point in the history
  • Loading branch information
martinlingstuyl authored and milanholemans committed Oct 9, 2023
1 parent cd40e99 commit a08895f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ export class Auth {
const cli = Cli.getInstance();
cli.spinner.text = response.message;
cli.spinner.spinner = {
frames: ['🌶️ ']
frames: ['🌶️']
};

// don't show spinner if running tests
Expand Down
11 changes: 8 additions & 3 deletions src/cli/Cli.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Configstore from 'configstore';
import fs from 'fs';
import minimist from 'minimist';
import ora from 'ora';
import ora, { Options, Ora } from 'ora';
import os from 'os';
import path from 'path';
import { pathToFileURL } from 'url';
Expand Down Expand Up @@ -41,7 +41,7 @@ export class Cli {
private static instance: Cli;
private static defaultHelpMode = 'options';
public static helpModes: string[] = ['options', 'examples', 'remarks', 'response', 'full'];
public spinner = ora('Running command...');
public spinner: Ora;

private _config: Configstore | undefined;
public get config(): Configstore {
Expand All @@ -62,8 +62,13 @@ export class Cli {
}
}

// eslint-disable-next-line @typescript-eslint/no-empty-function
private constructor() {
const options: Options = {
text: 'Running command...',
/* c8 ignore next 1 */
stream: this.getSettingWithDefaultValue('errorOutput', 'stderr') === 'stderr' ? process.stderr : process.stdout
};
this.spinner = ora(options);
}

public static getInstance(): Cli {
Expand Down

0 comments on commit a08895f

Please sign in to comment.