diff --git a/README.md b/README.md index 2e1e0cd..a9b0633 100644 --- a/README.md +++ b/README.md @@ -10,20 +10,28 @@ To run this, you'll need Go installed. With that, you can compile the project: go get github.com/writeas/text-pic/cmd/wfgraphic-cli ``` -Then you can run `wfgraphic-cli` with the options below. The actual content of the graphic is read from `stdin`, which you can either supply when prompted to, or pipe in (e.g. `cat quote.txt | ./wfgraphic-cli`). +Then you can run `wfgraphic-cli` with the options below. ``` Usage of wfgraphic-cli: -font string Post font (options: "serif", "sans", "mono") (default "serif") -i string - WriteFreely instance hostname (e.g. pencil.writefree.ly) (default "write.as") + WriteFreely instance hostname (e.g. "pencil.writefree.ly") -o string Image output filename (default "out.png") + -size string + Image size, either a single number for a square (e.g. "900") or a combined width and height (e.g. "1080x1920") (default "1024") -u string WriteFreely author username (for multi-user instances) ``` +The actual content of the graphic is read from `stdin`, which you can either supply when prompted to, or pipe in, for example: + +``` +cat quote.txt | ./wfgraphic-cli -i write.as -u blog +``` + ## Examples diff --git a/cmd/wfgraphic-cli/main.go b/cmd/wfgraphic-cli/main.go index a06d239..3f04ac1 100644 --- a/cmd/wfgraphic-cli/main.go +++ b/cmd/wfgraphic-cli/main.go @@ -25,7 +25,7 @@ import ( var ( outputFile = flag.String("o", "out.png", "Image output filename") font = flag.String("font", "serif", "Post font (options: \"serif\", \"sans\", \"mono\")") - instance = flag.String("i", "write.as", "WriteFreely instance hostname (e.g. \"pencil.writefree.ly\")") + instance = flag.String("i", "", "WriteFreely instance hostname (e.g. \"pencil.writefree.ly\")") author = flag.String("u", "", "WriteFreely author username (for multi-user instances)") size = flag.String("size", "1024", "Image size, either a single number for a square (e.g. \"900\") or a combined width and height (e.g. \"1080x1920\")") ) @@ -35,6 +35,11 @@ func main() { flag.Parse() // Validate input + if *instance == "" { + log.Info("Aborting. Instance name (-i instance.tld) is required") + flag.Usage() + os.Exit(1) + } if !textpic.IsValidFont(*font) { log.Info("Invalid --font given. Options: \"serif\", \"sans\", \"mono\"") os.Exit(1) diff --git a/options.go b/options.go index 0459cfe..6d6da64 100644 --- a/options.go +++ b/options.go @@ -39,9 +39,6 @@ func NewContentOptions(instance, username string, isSubdomain bool, font, conten UserFont: font, Content: content, } - if opt.Instance == "" { - opt.Instance = "write.as" - } if opt.Content == "" { opt.Content = "Hello, world!" }