@@ -2,9 +2,11 @@ const cac = require('cac')
2
2
const path = require ( 'path' )
3
3
const fs = require ( 'fs' )
4
4
const spawn = require ( 'cross-spawn' )
5
+ const ora = require ( 'ora' )
5
6
const parseArgs = require ( '../utils/parseArgs' )
6
7
const logger = require ( '../utils/logger' )
7
8
const matcher = require ( 'multimatch' )
9
+ const kleur = require ( 'kleur' )
8
10
9
11
module . exports = class Core {
10
12
constructor ( ) {
@@ -79,19 +81,22 @@ module.exports = class Core {
79
81
const matched = matcher ( this . getBranch ( options ) , branches )
80
82
81
83
matched . forEach ( branch => {
82
- const args = options . remotes
84
+ const spinner = ora ( `Deleting${ this . text ( branch ) } ` )
85
+ spinner . start ( )
86
+ const args = this . isRemotes
83
87
? [ 'push' , options . scope , `:${ branch } ` ]
84
88
: [ 'branch' , branch , '-D' ]
85
89
const ps = spawn . sync ( 'git' , args )
86
90
if ( ps . status === 0 ) {
87
- logger . success (
88
- `Deleted${ options . remotes ? ' remote' : '' } branch` ,
89
- `\`${ branch } \``
90
- )
91
+ spinner . succeed ( `Deleted${ this . text ( branch ) } ` )
91
92
}
92
93
} )
93
94
}
94
95
96
+ text ( branch ) {
97
+ return `${ this . isRemotes ? ' remotes' : '' } branch ` + kleur . magenta ( branch )
98
+ }
99
+
95
100
run ( ) {
96
101
this . cli . runMatchedCommand ( )
97
102
}
0 commit comments