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<()> {
50
50
. arg (
51
51
Arg :: with_name ( "input" )
52
52
. help ( "Input SVD file" )
53
- . required ( true )
54
53
. short ( "i" )
55
54
. takes_value ( true )
56
55
. value_name ( "FILE" ) ,
@@ -74,10 +73,21 @@ fn run() -> Result<()> {
74
73
. unwrap_or ( Ok ( Target :: CortexM ) ) ?;
75
74
76
75
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
+ }
81
91
82
92
let device = svd:: parse ( xml) ;
83
93
You can’t perform that action at this time.
0 commit comments