typeprint/go/bin.go
Elliott Pardee 8213cf927a overhaul this shit
and i made my first program in C that's remotely useful, so that's good
2015-06-07 04:05:37 -04:00

37 lines
573 B
Go

package main
import (
"os"
"io/ioutil"
"fmt"
"time"
)
func processFile(filename string) {
file, err := ioutil.ReadFile(filename)
if err != nil {
panic(err)
}
for _, j := range file {
if string(j) == "\n" {
fmt.Printf("\n")
} else {
fmt.Printf("%c", j)
}
time.Sleep(time.Millisecond * time.Duration(10))
}
}
func main() {
args := os.Args[1:]
if len(args) == 1 {
processFile(args[0])
} else {
fmt.Println("needs a file to process")
}
}