Skip to content

Commit

Permalink
Allow the disassembler to accept input from stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
nlowe committed Dec 12, 2019
1 parent ca46f81 commit 6963bf4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion intcode/disassembler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@ func main() {
os.Exit(1)
}

f, err := ioutil.ReadFile(os.Args[1])
var f []byte
var err error

if os.Args[1] == "-" {
f, err = ioutil.ReadAll(os.Stdin)
} else {
f, err = ioutil.ReadFile(os.Args[1])
}

if err != nil {
panic(err)
}
Expand Down

0 comments on commit 6963bf4

Please sign in to comment.