@@ -13,6 +13,7 @@ export default new Command()
1313 . helpOption ( '-h, --help' , 'Show help' )
1414 . option ( '--cache-only' , 'Only use cached data, and fail if there is new i18n data to process' )
1515 . option ( '--skip-cache' , 'Skip using cached data and process all i18n data' )
16+ . option ( '--locale <locale>' , 'Locale to process' )
1617 . action ( async ( options ) => {
1718 let spinner = Ora ( ) ;
1819
@@ -28,11 +29,18 @@ export default new Command()
2829 } ) ;
2930 spinner . succeed ( `Authenticated as ${ auth . email } .` ) ;
3031
31-
3232 const sourceLocale = config . locale . source ;
33- const targetLocales = config . locale . targets ;
33+ let targetLocales = config . locale . targets ;
3434 const bucketEntries = Object . entries ( config . buckets ! ) ;
3535
36+ if ( flags . locale ) {
37+ if ( ! targetLocales . includes ( flags . locale as any ) ) {
38+ spinner . warn ( `Target locale ${ flags . locale } not found in configuration. Skipping...` ) ;
39+ targetLocales = [ ] ;
40+ } else {
41+ targetLocales = [ flags . locale as any ] ;
42+ }
43+ }
3644 if ( ! targetLocales . length ) {
3745 spinner . warn ( 'No target locales found in configuration. Please add at least one target locale.' ) ;
3846 } else if ( ! bucketEntries . length ) {
@@ -75,6 +83,7 @@ async function loadFlags(options: any) {
7583 const flags = Z . object ( {
7684 cacheOnly : Z . boolean ( ) . optional ( ) . default ( false ) ,
7785 skipCache : Z . boolean ( ) . optional ( ) . default ( false ) ,
86+ locale : Z . string ( ) . optional ( ) ,
7887 } )
7988 . passthrough ( )
8089 . parse ( options ) ;
0 commit comments