diff --git a/cmd/wfgraphic-cli/main.go b/cmd/wfgraphic-cli/main.go index f6cc525..8a15095 100644 --- a/cmd/wfgraphic-cli/main.go +++ b/cmd/wfgraphic-cli/main.go @@ -24,19 +24,13 @@ var ( outputFile = flag.String("o", "out.png", "Image output filename") font = flag.String("font", "serif", "Post font (options: \"serif\", \"sans\", \"mono\") - NOT IMPLEMENTED YET") instance = flag.String("i", "write.as", "WriteFreely instance hostname (e.g. pencil.writefree.ly)") - author = flag.String("u", "", "WriteFreely author username") + author = flag.String("u", "", "WriteFreely author username (for multi-user instances)") ) func main() { log.Info("Starting...") flag.Parse() - if *author == "" { - log.Info("Aborting. -u flag is required") - flag.Usage() - os.Exit(1) - } - log.Info("Reading input...") in, err := ioutil.ReadAll(os.Stdin) if err != nil { diff --git a/textpic.go b/textpic.go index 88ecb75..a5e2c9b 100644 --- a/textpic.go +++ b/textpic.go @@ -73,7 +73,10 @@ func GenerateImage(opt *ContentOptions, outputFilename string) error { } dc.SetColor(color.Black) - userPath := "/" + opt.Username + var userPath = "" + if opt.Username != "" { + userPath = "/" + opt.Username + } userTextWidth, _ := dc.MeasureString(userPath) // x = canvas halfway point - total text width halfway point x = wf/2 - (baseTextWidth+userTextWidth)/2