commit 6d9fe3e358bbbb0aed0bbefb5b4bc572f460f752 Author: Elliott Pardee Date: Mon Apr 27 00:18:53 2015 -0400 Initial commit. diff --git a/bin.go b/bin.go new file mode 100644 index 0000000..1bdf78d --- /dev/null +++ b/bin.go @@ -0,0 +1,27 @@ +package main + +import ( + "os" + "io/ioutil" + "fmt" +) + +func processFile(filename string) { + file, err := ioutil.ReadFile(filename) + + if err != nil { + panic(err) + } + + typeprint(string(file)) +} + +func main() { + args := os.Args[1:] + + if len(args) == 1 { + processFile(args[0]) + } else { + fmt.Println("needs a file to process") + } +} diff --git a/typeprint.go b/typeprint.go new file mode 100644 index 0000000..89e90e8 --- /dev/null +++ b/typeprint.go @@ -0,0 +1,18 @@ +package main + +import ( + "fmt" + "time" +) + +func typeprint(s string) { + for _, j := range s { + if string(j) == "\n" { + fmt.Printf("\n") + } else { + fmt.Printf("%c", j) + } + + time.Sleep(time.Millisecond * time.Duration(10)) + } +}