@@ -79,9 +79,11 @@ struct Args {
7979 #[ argh( switch) ]
8080 dot_cfg_only : bool ,
8181
82- /// specify file path to process STDIN as
82+ /// use `stdin` for input, using the input file path only for format detection and diagnostics.
83+ ///
84+ /// This option is ignored when `--bulk-validate` is set.
8385 #[ argh( option) ]
84- stdin : Option < String > ,
86+ stdin : bool ,
8587
8688 /// generate debug symbols, only works for spv-out for now
8789 #[ argh( switch, short = 'g' ) ]
@@ -115,12 +117,9 @@ struct Args {
115117
116118 /// the input and output files.
117119 ///
118- /// First positional argument is the input file. If not specified, the
119- /// input will be read from stdin. In the case, --stdin must also be
120- /// specified.
121- ///
122- /// The rest arguments are the output files. If not specified, only
123- /// validation will be performed.
120+ /// The first argument is the input file path. The remaining arguments are
121+ /// the output files. If not specified, only validation will be
122+ /// performed.
124123 ///
125124 /// In bulk validation mode, these are all input files to be validated.
126125 #[ argh( positional) ]
@@ -457,13 +456,15 @@ fn run() -> anyhow::Result<()> {
457456
458457 let mut files = args. files . iter ( ) ;
459458
460- let ( input_path, input) = if let Some ( path) = args. stdin . as_ref ( ) {
461- let mut input = vec ! [ ] ;
462- std:: io:: stdin ( ) . lock ( ) . read_to_end ( & mut input) ?;
463- ( Path :: new ( path) , input)
464- } else if let Some ( path) = files. next ( ) {
465- let path = Path :: new ( path) ;
466- ( path, fs:: read ( path) ?)
459+ let ( input_path, input) = if let Some ( path) = files. next ( ) {
460+ if args. stdin {
461+ let mut input = vec ! [ ] ;
462+ std:: io:: stdin ( ) . lock ( ) . read_to_end ( & mut input) ?;
463+ ( Path :: new ( path) , input)
464+ } else {
465+ let path = Path :: new ( path) ;
466+ ( path, fs:: read ( path) ?)
467+ }
467468 } else {
468469 return Err ( CliError ( "Input file path is not specified" ) . into ( ) ) ;
469470 } ;
0 commit comments