util: cli: Add common spinner helpers
This commit is contained in:
parent
e5c8ecfb4e
commit
7aa83fe8d1
1 changed files with 17 additions and 0 deletions
17
src/util/cli.ts
Normal file
17
src/util/cli.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import * as ora from 'ora'
|
||||
import * as chalk from 'chalk'
|
||||
|
||||
export function createActionSpinner(action: string) {
|
||||
return ora({
|
||||
prefixText: chalk.bold(chalk.greenBright(action)),
|
||||
color: 'green',
|
||||
})
|
||||
}
|
||||
|
||||
export function startActionSpinner(action: string) {
|
||||
return createActionSpinner(action).start()
|
||||
}
|
||||
|
||||
export function stopActionSpinner(spinner: ora.Ora) {
|
||||
spinner.stopAndPersist()
|
||||
}
|
Loading…
Reference in a new issue