Skip to content

Commit 409b43c

Browse files
martinlingstuylmilanholemans
authored andcommitted
Makes spinner stream configurable by errorOutput. Closes #5521
1 parent 6304187 commit 409b43c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/Auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ export class Auth {
423423
const cli = Cli.getInstance();
424424
cli.spinner.text = response.message;
425425
cli.spinner.spinner = {
426-
frames: ['🌶️ ']
426+
frames: ['🌶️']
427427
};
428428

429429
// don't show spinner if running tests

src/cli/Cli.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Configstore from 'configstore';
22
import fs from 'fs';
33
import minimist from 'minimist';
4-
import ora from 'ora';
4+
import ora, { Options, Ora } from 'ora';
55
import os from 'os';
66
import path from 'path';
77
import { pathToFileURL } from 'url';
@@ -41,7 +41,7 @@ export class Cli {
4141
private static instance: Cli;
4242
private static defaultHelpMode = 'options';
4343
public static helpModes: string[] = ['options', 'examples', 'remarks', 'response', 'full'];
44-
public spinner = ora('Running command...');
44+
public spinner: Ora;
4545

4646
private _config: Configstore | undefined;
4747
public get config(): Configstore {
@@ -62,8 +62,13 @@ export class Cli {
6262
}
6363
}
6464

65-
// eslint-disable-next-line @typescript-eslint/no-empty-function
6665
private constructor() {
66+
const options: Options = {
67+
text: 'Running command...',
68+
/* c8 ignore next 1 */
69+
stream: this.getSettingWithDefaultValue('errorOutput', 'stderr') === 'stderr' ? process.stderr : process.stdout
70+
};
71+
this.spinner = ora(options);
6772
}
6873

6974
public static getInstance(): Cli {

0 commit comments

Comments
 (0)