Skip to content

Commit 6416374

Browse files
committed
feat($core): use ora
close #2
1 parent 4e0bf26 commit 6416374

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/index.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ const cac = require('cac')
22
const path = require('path')
33
const fs = require('fs')
44
const spawn = require('cross-spawn')
5+
const ora = require('ora')
56
const parseArgs = require('../utils/parseArgs')
67
const logger = require('../utils/logger')
78
const matcher = require('multimatch')
9+
const kleur = require('kleur')
810

911
module.exports = class Core {
1012
constructor() {
@@ -79,19 +81,22 @@ module.exports = class Core {
7981
const matched = matcher(this.getBranch(options), branches)
8082

8183
matched.forEach(branch => {
82-
const args = options.remotes
84+
const spinner = ora(`Deleting${this.text(branch)}`)
85+
spinner.start()
86+
const args = this.isRemotes
8387
? ['push', options.scope, `:${branch}`]
8488
: ['branch', branch, '-D']
8589
const ps = spawn.sync('git', args)
8690
if (ps.status === 0) {
87-
logger.success(
88-
`Deleted${options.remotes ? ' remote' : ''} branch`,
89-
`\`${branch}\``
90-
)
91+
spinner.succeed(`Deleted${this.text(branch)}`)
9192
}
9293
})
9394
}
9495

96+
text(branch) {
97+
return `${this.isRemotes ? ' remotes' : ''} branch ` + kleur.magenta(branch)
98+
}
99+
95100
run() {
96101
this.cli.runMatchedCommand()
97102
}

0 commit comments

Comments
 (0)