File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -102,10 +102,20 @@ module.exports = function (opts = {}) {
102102 }
103103 }
104104
105+ // Handle default as functions, augment with entire options
106+ const __default = typeof defaults [ key ] !== 'undefined' ? defaults [ key ] : flag . default
107+ let _default = __default
108+ if ( typeof _default === 'function' ) {
109+ _default = ( ans ) => {
110+ return __default ( ans , values ( ans ) )
111+ }
112+ }
113+
105114 cli . option ( flag . key || key , {
106115 description : o . description ,
107116 type : o . type ,
108117 group : o . group ,
118+ default : _default ,
109119 coerce,
110120 ...o . flag
111121 } )
@@ -177,7 +187,7 @@ module.exports = function (opts = {}) {
177187 const __default = typeof defaults [ key ] !== 'undefined' ? defaults [ key ] : prompt . default
178188 let _default = __default
179189 if ( typeof _default === 'function' ) {
180- _default = async ( ans ) => {
190+ _default = ( ans ) => {
181191 return __default ( ans , values ( ans ) )
182192 }
183193 }
Original file line number Diff line number Diff line change @@ -123,9 +123,7 @@ suite(pkg.name, () => {
123123 } ,
124124 remoteOrigin : {
125125 description : 'remote origin' ,
126- default : async ( input , opts ) => {
127- // Ensure we get the input including defaults
128- assert . strictEqual ( opts . cwd , TMP )
126+ default : ( input , opts ) => {
129127 // Fake load git remote origin
130128 return remote
131129 }
@@ -139,7 +137,7 @@ suite(pkg.name, () => {
139137 assert . strictEqual ( typeof prompts [ 0 ] . default , 'function' )
140138
141139 return {
142- remoteOrigin : await prompts [ 0 ] . default ( { } )
140+ remoteOrigin : prompts [ 0 ] . default ( )
143141 }
144142 }
145143 }
You can’t perform that action at this time.
0 commit comments