@@ -8,7 +8,7 @@ import {ExitError} from './exit'
8
8
import { IPromptOptions } from './prompt'
9
9
import * as Table from './styled/table'
10
10
11
- export const cli = {
11
+ export const ux = {
12
12
config,
13
13
14
14
warn : Errors . warn ,
@@ -18,7 +18,7 @@ export const cli = {
18
18
get prompt ( ) { return deps . prompt . prompt } ,
19
19
get confirm ( ) { return deps . prompt . confirm } ,
20
20
get action ( ) { return config . action } ,
21
- styledObject ( obj : any , keys ?: string [ ] ) { cli . info ( deps . styledObject ( obj , keys ) ) } ,
21
+ styledObject ( obj : any , keys ?: string [ ] ) { ux . info ( deps . styledObject ( obj , keys ) ) } ,
22
22
get styledHeader ( ) { return deps . styledHeader } ,
23
23
get styledJSON ( ) { return deps . styledJSON } ,
24
24
get table ( ) { return deps . table } ,
@@ -72,24 +72,25 @@ export const cli = {
72
72
function timeout ( p : Promise < any > , ms : number ) {
73
73
function wait ( ms : number , unref : boolean = false ) {
74
74
return new Promise ( resolve => {
75
- let t : any = setTimeout ( resolve , ms )
75
+ let t : any = setTimeout ( ( ) => resolve ( ) , ms )
76
76
if ( unref ) t . unref ( )
77
77
} )
78
78
}
79
79
80
- return Promise . race ( [ p , wait ( ms , true ) . then ( ( ) => cli . warn ( 'timed out' ) ) ] )
80
+ return Promise . race ( [ p , wait ( ms , true ) . then ( ( ) => ux . warn ( 'timed out' ) ) ] )
81
81
}
82
82
83
83
async function flush ( ) {
84
- let p = new Promise ( resolve => process . stdout . once ( 'drain' , resolve ) )
84
+ let p = new Promise ( resolve => process . stdout . once ( 'drain' , ( ) => resolve ( ) ) )
85
85
process . stdout . write ( '' )
86
86
return p
87
87
}
88
88
89
89
await timeout ( flush ( ) , 10000 )
90
90
}
91
91
}
92
- export default cli
92
+ export default ux
93
+ export const cli = ux
93
94
94
95
export {
95
96
config ,
@@ -102,7 +103,7 @@ export {
102
103
103
104
process . once ( 'exit' , async ( ) => {
104
105
try {
105
- await cli . done ( )
106
+ await ux . done ( )
106
107
} catch ( err ) {
107
108
// tslint:disable no-console
108
109
console . error ( err )
0 commit comments