normalise whitespace

This commit is contained in:
Luke Emmet 2020-07-31 11:11:24 +01:00
parent dbedc4d697
commit 4d21a9e9b0

View File

@ -1,13 +1,13 @@
package main package main
import ( import (
flag "github.com/spf13/pflag" flag "github.com/spf13/pflag"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"github.com/LukeEmmet/html2gemini" "github.com/LukeEmmet/html2gemini"
"bufio" "bufio"
"io" "io"
"errors" "errors"
) )
@ -31,16 +31,16 @@ func saveFile(contents []byte, path string) {
func readStdin () (string) { func readStdin () (string) {
// based on https://flaviocopes.com/go-shell-pipes/ // based on https://flaviocopes.com/go-shell-pipes/
reader := bufio.NewReader(os.Stdin) //default size is 4096 apparently reader := bufio.NewReader(os.Stdin) //default size is 4096 apparently
var output []rune var output []rune
for { for {
input, _, err := reader.ReadRune() input, _, err := reader.ReadRune()
if err != nil && err == io.EOF { if err != nil && err == io.EOF {
break break
} }
output = append(output, input) output = append(output, input)
} }
return string(output) return string(output)
} }