diff --git a/cmd/gutcontent/main.go b/cmd/gutcontent/main.go index 7484ec1..7bd4bb8 100644 --- a/cmd/gutcontent/main.go +++ b/cmd/gutcontent/main.go @@ -1,5 +1,5 @@ /* -Given a project gutenberg plaintext book filename, this program prints just its content (ie with header and footer stripped) +Given a project gutenberg plaintext book on STDIN, this program prints just its content (ie with header and footer stripped) */ package main @@ -12,18 +12,7 @@ import ( ) func main() { - if len(os.Args) < 2 { - fmt.Fprintln(os.Stderr, "need a filename argument") - os.Exit(1) - } - filename := os.Args[1] - f, err := os.Open(filename) - if err != nil { - fmt.Fprintf(os.Stderr, "could not open '%s' for reading\n", filename) - os.Exit(2) - } - - s := bufio.NewScanner(f) + s := bufio.NewScanner(os.Stdin) inHeader := true inFooter := false skippedAll := true diff --git a/cmd/phraser/main.go b/cmd/phraser/main.go index c4c49b9..2597de2 100644 --- a/cmd/phraser/main.go +++ b/cmd/phraser/main.go @@ -63,3 +63,9 @@ func main() { } } } + +func clean(s string) string { + s = strings.ReplaceAll(s, "’", "'") + + return s +}