normalise whitespace
This commit is contained in:
parent
dbedc4d697
commit
4d21a9e9b0
@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user