Remove default instance
This commit is contained in:
parent
9244e91e1b
commit
c4df3dded3
12
README.md
12
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
|
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:
|
Usage of wfgraphic-cli:
|
||||||
-font string
|
-font string
|
||||||
Post font (options: "serif", "sans", "mono") (default "serif")
|
Post font (options: "serif", "sans", "mono") (default "serif")
|
||||||
-i string
|
-i string
|
||||||
WriteFreely instance hostname (e.g. pencil.writefree.ly) (default "write.as")
|
WriteFreely instance hostname (e.g. "pencil.writefree.ly")
|
||||||
-o string
|
-o string
|
||||||
Image output filename (default "out.png")
|
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
|
-u string
|
||||||
WriteFreely author username (for multi-user instances)
|
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
|
## Examples
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
var (
|
var (
|
||||||
outputFile = flag.String("o", "out.png", "Image output filename")
|
outputFile = flag.String("o", "out.png", "Image output filename")
|
||||||
font = flag.String("font", "serif", "Post font (options: \"serif\", \"sans\", \"mono\")")
|
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)")
|
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\")")
|
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()
|
flag.Parse()
|
||||||
|
|
||||||
// Validate input
|
// Validate input
|
||||||
|
if *instance == "" {
|
||||||
|
log.Info("Aborting. Instance name (-i instance.tld) is required")
|
||||||
|
flag.Usage()
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
if !textpic.IsValidFont(*font) {
|
if !textpic.IsValidFont(*font) {
|
||||||
log.Info("Invalid --font given. Options: \"serif\", \"sans\", \"mono\"")
|
log.Info("Invalid --font given. Options: \"serif\", \"sans\", \"mono\"")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -39,9 +39,6 @@ func NewContentOptions(instance, username string, isSubdomain bool, font, conten
|
|||||||
UserFont: font,
|
UserFont: font,
|
||||||
Content: content,
|
Content: content,
|
||||||
}
|
}
|
||||||
if opt.Instance == "" {
|
|
||||||
opt.Instance = "write.as"
|
|
||||||
}
|
|
||||||
if opt.Content == "" {
|
if opt.Content == "" {
|
||||||
opt.Content = "Hello, world!"
|
opt.Content = "Hello, world!"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user