Line break after error messages in the console
This commit is contained in:
parent
8a9dc84555
commit
45a47ce408
26
main.go
26
main.go
|
@ -1,13 +1,13 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"bytes"
|
||||
"os"
|
||||
"fmt"
|
||||
"bufio"
|
||||
"regexp"
|
||||
"bytes"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var outFile bytes.Buffer
|
||||
|
@ -45,7 +45,7 @@ func deconstructComment(ln string) string {
|
|||
|
||||
func readFile(path string, buildComments bool) {
|
||||
file, err := os.Open(path)
|
||||
errorExit(err, fmt.Sprintf("Unable to open file for reading: %s", path))
|
||||
errorExit(err, fmt.Sprintf("Unable to open file for reading: %s\n", path))
|
||||
defer file.Close()
|
||||
|
||||
re := regexp.MustCompile(`.+\t.*\t.*\t.*`)
|
||||
|
@ -80,8 +80,8 @@ func readFile(path string, buildComments bool) {
|
|||
}
|
||||
|
||||
func writeFile(path string) {
|
||||
file, err := os.OpenFile(path, os.O_WRONLY | os.O_CREATE | os.O_TRUNC, 0)
|
||||
errorExit(err, fmt.Sprintf("Unable to open file for writing: %s", path))
|
||||
file, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0)
|
||||
errorExit(err, fmt.Sprintf("Unable to open file for writing: %s\n", path))
|
||||
defer file.Close()
|
||||
file.Write(outFile.Bytes())
|
||||
}
|
||||
|
@ -103,16 +103,16 @@ example: gfu -d ~/gopher/phlog/gophermap
|
|||
|
||||
func main() {
|
||||
deconstructCommentLinks := flag.Bool("d", false, "Deconstruct a gophermap's comments back to regular text")
|
||||
header := flag.String("head","","Path to a file containing header content")
|
||||
footer := flag.String("foot","","Path to a file containing footer content")
|
||||
header := flag.String("head", "", "Path to a file containing header content")
|
||||
footer := flag.String("foot", "", "Path to a file containing footer content")
|
||||
flag.Usage = PrintHelp
|
||||
|
||||
flag.Parse()
|
||||
|
||||
|
||||
args := flag.Args()
|
||||
|
||||
|
||||
if l := len(args); l != 1 {
|
||||
fmt.Printf("Incorrect number of arguments. Expected 1, got %d", l)
|
||||
fmt.Printf("Incorrect number of arguments. Expected 1, got %d\n", l)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue