File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,6 @@ fn run() -> Result<()> {
5050 . arg (
5151 Arg :: with_name ( "input" )
5252 . help ( "Input SVD file" )
53- . required ( true )
5453 . short ( "i" )
5554 . takes_value ( true )
5655 . value_name ( "FILE" ) ,
@@ -74,10 +73,21 @@ fn run() -> Result<()> {
7473 . unwrap_or ( Ok ( Target :: CortexM ) ) ?;
7574
7675 let xml = & mut String :: new ( ) ;
77- File :: open ( matches. value_of ( "input" ) . unwrap ( ) )
78- . chain_err ( || "couldn't open the SVD file" ) ?
79- . read_to_string ( xml)
80- . chain_err ( || "couldn't read the SVD file" ) ?;
76+ match matches. value_of ( "input" ) {
77+ Some ( file) => {
78+ File :: open ( file)
79+ . chain_err ( || "couldn't open the SVD file" ) ?
80+ . read_to_string ( xml)
81+ . chain_err ( || "couldn't read the SVD file" ) ?;
82+ }
83+ None => {
84+ let stdin = std:: io:: stdin ( ) ;
85+ stdin
86+ . lock ( )
87+ . read_to_string ( xml)
88+ . chain_err ( || "couldn't read from stdin" ) ?;
89+ }
90+ }
8191
8292 let device = svd:: parse ( xml) ;
8393
You can’t perform that action at this time.
0 commit comments