Commit e7c6c6a 1 parent bfbf0ae commit e7c6c6a Copy full SHA for e7c6c6a
File tree 3 files changed +13
-9
lines changed
3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,11 @@ module.exports = {
95
95
describe : 'Enable verbose output' ,
96
96
type : 'boolean'
97
97
} )
98
+ . options ( 'prompt' , {
99
+ describe : 'Disable UI prompting (useful for bash scripting)' ,
100
+ type : 'boolean' ,
101
+ default : true
102
+ } )
98
103
. version ( )
99
104
. help ( )
100
105
. parse ( argv ) ;
Original file line number Diff line number Diff line change @@ -108,7 +108,8 @@ class Command {
108
108
let verbose = argv . verbose ;
109
109
110
110
let ui = new UI ( {
111
- verbose : verbose
111
+ verbose : verbose ,
112
+ allowPrompt : argv . prompt
112
113
} ) ;
113
114
let service = ServiceManager . load ( ui ) ;
114
115
let context = {
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ const defaultOptions = {
17
17
stdin : process . stdin ,
18
18
stdout : process . stdout ,
19
19
stderr : process . stderr ,
20
- verbose : false
20
+ verbose : false ,
21
+ allowPrompt : true
21
22
} ;
22
23
23
24
class UI {
@@ -29,6 +30,7 @@ class UI {
29
30
this . stdout = this . options . stdout ;
30
31
this . stderr = this . options . stderr ;
31
32
this . verbose = this . options . verbose ;
33
+ this . allowPrompt = this . options . allowPrompt ;
32
34
33
35
// Add custom prompt module that uses the
34
36
// specified streams
@@ -68,15 +70,11 @@ class UI {
68
70
}
69
71
70
72
prompt ( prompts ) {
71
- if ( ! this . spinner ) {
72
- return this . inquirer ( prompts ) ;
73
+ if ( ! this . allowPrompt ) {
74
+ throw new errors . SystemError ( 'Prompts have been disabled, please provide options via command line flags' ) ;
73
75
}
74
76
75
- this . spinner . stop ( ) ;
76
- return this . inquirer ( prompts ) . then ( ( result ) => {
77
- this . spinner . start ( ) ;
78
- return result ;
79
- } ) ;
77
+ return this . noSpin ( ( ) => this . inquirer ( prompts ) ) ;
80
78
}
81
79
82
80
sudo ( command , options ) {
You can’t perform that action at this time.
0 commit comments