summaryrefslogtreecommitdiff
path: root/bookpipeline/cmd/booktopipeline/main.go
diff options
context:
space:
mode:
authorNick White <git@njw.name>2019-10-02 12:53:41 +0100
committerNick White <git@njw.name>2019-10-02 12:55:07 +0100
commita78b620220945ce15ab9965701ab5e7d39f314f1 (patch)
treeabd288ceaaf47c65b972e9fbb4cc4dce8373a59a /bookpipeline/cmd/booktopipeline/main.go
parentdc3f330570a45d5c7a22e1e23fc0bb3200a78afa (diff)
Improve usage notice for booktopipeline
Diffstat (limited to 'bookpipeline/cmd/booktopipeline/main.go')
-rw-r--r--bookpipeline/cmd/booktopipeline/main.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/bookpipeline/cmd/booktopipeline/main.go b/bookpipeline/cmd/booktopipeline/main.go
index 296f2c2..6d9f146 100644
--- a/bookpipeline/cmd/booktopipeline/main.go
+++ b/bookpipeline/cmd/booktopipeline/main.go
@@ -4,6 +4,7 @@ package main
import (
"flag"
+ "fmt"
"log"
"os"
"path/filepath"
@@ -14,6 +15,15 @@ import (
"github.com/aws/aws-sdk-go/service/sqs"
)
+const usage = `Usage: booktopipeline [-prebinarised] [-v] bookdir [bookname]
+
+Uploads the book in bookdir to the S3 'inprogress' bucket and adds it
+to the 'preprocess' SQS queue, or the 'wipeonly' queue if the
+prebinarised flag is set.
+
+If bookname is omitted the last part of the bookdir is used.
+`
+
// null writer to enable non-verbose logging to be discarded
type NullWriter bool
@@ -38,10 +48,15 @@ func (f fileWalk) Walk(path string, info os.FileInfo, err error) error {
func main() {
verbose := flag.Bool("v", false, "Verbose")
wipeonly := flag.Bool("prebinarised", false, "Prebinarised: only preprocessing will be to wipe")
- flag.Parse()
+ flag.Usage = func() {
+ fmt.Fprintf(flag.CommandLine.Output(), usage)
+ flag.PrintDefaults()
+ }
+ flag.Parse()
if flag.NArg() < 1 {
- log.Fatal("Usage: booktopipeline [-v] bookdir [bookname]\n\nUploads the book in bookdir to the S3 'inprogress' bucket and adds it to the 'preprocess' SQS queue\nIf bookname is omitted the last part of the bookdir is used\n")
+ flag.Usage()
+ return
}
bookdir := flag.Arg(0)