Skip to content

Commit

Permalink
Implemented an updated method to change the current spinner text output
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchPierias committed May 26, 2019
1 parent 4d8867e commit b01f876
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/cli/logIndicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,25 @@ export const create = (text: string) => {
delete cache.spinner;
}
// Create and cache spinner
cache.spinner = ora({
text: colors.white(text),
color: 'magenta',
}).start();
update(text);
};

/**
* Updates the text of the current spinner
* @author Mitch Pierias <github.com/MitchPierias>
* @param text CLI output text to display
*/
export const update = (text:string) => {
// Create spinner when missing
if (!cache.spinner)
cache.spinner = ora({
text: colors.white(text),
color: 'magenta',
}).start();
// Update spinner text
cache.spinner.text = colors.white(text);
}

/**
* Terminates the current spinner with the specified output message
* @author Mitch Pierias <github.com/MitchPierias>
Expand Down

0 comments on commit b01f876

Please sign in to comment.