@@ -197,7 +197,7 @@ async function main() {
197197 const yarnCacheDir = execSync ( 'yarn cache dir' ) . toString ( ) . trim ( ) ;
198198 console . debug ( `Yarn cache directory: ${ yarnCacheDir } ` ) ;
199199
200- const { target, dest, cache, cache_disable , tools } = yargs
200+ const { target, dest, cache, tools } = yargs
201201 . option ( 't' , {
202202 alias : 'target' ,
203203 description : 'VS Code extension target, defaults to system' ,
@@ -214,11 +214,6 @@ async function main() {
214214 description : 'Directory for caching tool downloads' ,
215215 default : yarnCacheDir
216216 } )
217- . option ( 'no-cache' , {
218- description : 'Disable caching of tool downloads' ,
219- type : 'boolean' ,
220- default : false
221- } )
222217 . version ( false )
223218 . strict ( )
224219 . command ( '$0 [<tools> ...]' , 'Downloads the tool(s) for the given architecture and OS' , y => {
@@ -229,14 +224,23 @@ async function main() {
229224 default : Object . keys ( TOOLS )
230225 } ) ;
231226 } )
232- . argv as unknown as { target : VsceTarget , dest : string , cache : string , cache_disable : boolean , tools : ( keyof typeof TOOLS ) [ ] } ;
227+ . argv as unknown as { target : VsceTarget , dest : string , cache : string | boolean , tools : ( keyof typeof TOOLS ) [ ] } ;
233228
234229 if ( ! existsSync ( dest ) ) {
235230 mkdirSync ( dest , { recursive : true } ) ;
236231 }
237232
233+ const cacheFolder = ( cache : string | boolean ) => {
234+ if ( typeof cache === 'string' ) {
235+ return cache ;
236+ } else if ( cache === true ) {
237+ return yarnCacheDir ;
238+ }
239+ return undefined ;
240+ }
241+
238242 for ( const tool of new Set ( tools ) ) {
239- TOOLS [ tool ] ( target , dest , { cache : cache_disable ? undefined : cache } ) ;
243+ TOOLS [ tool ] ( target , dest , { cache : cacheFolder ( cache ) } ) ;
240244 }
241245}
242246
0 commit comments