@@ -18,6 +18,7 @@ mod rendering;
1818#[ derive( Eq , Debug , PartialEq ) ]
1919enum Output {
2020 Native ,
21+ Typst ,
2122 Silent ,
2223}
2324
@@ -113,8 +114,8 @@ fn main() {
113114 Arg :: new ( "output" )
114115 . short ( 'o' )
115116 . long ( "output" )
116- . value_parser ( [ "pdf " , "typst " ] )
117- . default_value ( "pdf " )
117+ . value_parser ( [ "typst " , "none " ] )
118+ . default_value ( "none " )
118119 . action ( ArgAction :: Set )
119120 . help ( "Output format: pdf (default) or typst markup." )
120121 )
@@ -225,11 +226,16 @@ fn main() {
225226 print ! ( "{}" , result) ;
226227 }
227228 Some ( ( "render" , submatches) ) => {
228- let output_format = submatches
229+ let output = submatches
229230 . get_one :: < String > ( "output" )
230231 . unwrap ( ) ;
232+ let output = match output. as_str ( ) {
233+ "typst" => Output :: Typst ,
234+ "none" => Output :: Silent ,
235+ _ => panic ! ( "Unrecognized --output value" ) ,
236+ } ;
231237
232- debug ! ( output_format ) ;
238+ debug ! ( ?output ) ;
233239
234240 let filename = submatches
235241 . get_one :: < String > ( "filename" )
@@ -261,16 +267,18 @@ fn main() {
261267
262268 let result = formatting:: render ( & Typst , & technique, 70 ) ;
263269
264- match output_format . as_str ( ) {
265- "typst" => {
270+ match output {
271+ Output :: Typst => {
266272 print ! ( "{}" , result) ;
267- // and exit
268- std:: process:: exit ( 0 ) ;
269273 }
270274 _ => {
271- rendering:: via_typst ( & filename, & result) ;
275+ // ignore; the default is to not output any intermediate
276+ // representations and instead proceed to invoke the
277+ // typesetter to generate the desired PDF.
272278 }
273279 }
280+
281+ rendering:: via_typst ( & filename, & result) ;
274282 }
275283 Some ( _) => {
276284 println ! ( "No valid subcommand was used" )
0 commit comments