@@ -75,6 +75,11 @@ static async Task<int> Main(string[] args)
7575 description : "npm package version (e.g., 1.0.0)" ,
7676 getDefaultValue : ( ) => "0.0.1" ) ;
7777
78+ var compressOption = new Option < bool > (
79+ aliases : new [ ] { "--compress" } ,
80+ description : "Gzip compress the output (proto format only)" ,
81+ getDefaultValue : ( ) => false ) ;
82+
7883 generateCommand . AddOption ( inputOption ) ;
7984 generateCommand . AddOption ( outputOption ) ;
8085 generateCommand . AddOption ( formatOption ) ;
@@ -86,6 +91,7 @@ static async Task<int> Main(string[] args)
8691 generateCommand . AddOption ( packageOption ) ;
8792 generateCommand . AddOption ( packageNameOption ) ;
8893 generateCommand . AddOption ( packageVersionOption ) ;
94+ generateCommand . AddOption ( compressOption ) ;
8995
9096 generateCommand . SetHandler ( async ( context ) =>
9197 {
@@ -100,8 +106,9 @@ static async Task<int> Main(string[] args)
100106 var package_ = context . ParseResult . GetValueForOption ( packageOption ) ;
101107 var packageName = context . ParseResult . GetValueForOption ( packageNameOption ) ;
102108 var packageVersion = context . ParseResult . GetValueForOption ( packageVersionOption ) ;
109+ var compress = context . ParseResult . GetValueForOption ( compressOption ) ;
103110
104- var exitCode = await Generate ( input , output , format , namespaces , raw , singleFile , strict , exports , package_ , packageName , packageVersion ) ;
111+ var exitCode = await Generate ( input , output , format , namespaces , raw , singleFile , strict , exports , package_ , packageName , packageVersion , compress ) ;
105112 context . ExitCode = exitCode ;
106113 } ) ;
107114
@@ -136,7 +143,7 @@ static async Task<int> Main(string[] args)
136143 return await rootCommand . InvokeAsync ( args ) ;
137144 }
138145
139- static async Task < int > Generate ( string input , string output , string format , string [ ] ? namespaces , bool raw , bool singleFile , bool strict , bool exports , bool package_ , string ? packageName , string ? packageVersion )
146+ static async Task < int > Generate ( string input , string output , string format , string [ ] ? namespaces , bool raw , bool singleFile , bool strict , bool exports , bool package_ , string ? packageName , string ? packageVersion , bool compress )
140147 {
141148 Console . WriteLine ( $ "Generating { format } output...") ;
142149 Console . WriteLine ( $ "Input: { input } ") ;
@@ -210,7 +217,8 @@ static async Task<int> Generate(string input, string output, string format, stri
210217 PackageVersion = packageVersion ?? "0.0.1" ,
211218 Namespaces = namespaces ? . Length > 0
212219 ? new HashSet < string > ( namespaces . SelectMany ( n => n . Split ( ',' ) ) , StringComparer . OrdinalIgnoreCase )
213- : null
220+ : null ,
221+ Compress = compress
214222 } ;
215223
216224 exporter . Export ( db , output , options ) ;
0 commit comments