summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.name>2020-03-23 10:45:59 +0000
committerNick White <git@njw.name>2020-03-23 10:45:59 +0000
commit148eab7c04a6eddb439ddcdb0a3ba12d03bb625b (patch)
tree3ae9ea7239cff2e75af0bdb38c2ecdf1e1c3c48f
parent17a0615ff3d40fa2835ffd11ce28cdf5327bfc90 (diff)
[getpipelinebook] Add -graph flag to download just graphs
-rw-r--r--cmd/getpipelinebook/main.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/cmd/getpipelinebook/main.go b/cmd/getpipelinebook/main.go
index f0dd4cf..f1092f8 100644
--- a/cmd/getpipelinebook/main.go
+++ b/cmd/getpipelinebook/main.go
@@ -16,7 +16,7 @@ import (
"rescribe.xyz/bookpipeline"
)
-const usage = `Usage: getpipelinebook [-a] [-pdf] [-png] [-v] bookname
+const usage = `Usage: getpipelinebook [-a] [-graph] [-pdf] [-png] [-v] bookname
Downloads the pipeline results for a book.
@@ -56,7 +56,8 @@ func getpdfs(conn Pipeliner, l *log.Logger, bookname string) {
func main() {
all := flag.Bool("a", false, "Get all files for book")
- pdf := flag.Bool("pdf", false, "Only download PDFs")
+ graph := flag.Bool("graph", false, "Only download graphs (can be used alongside -pdf)")
+ pdf := flag.Bool("pdf", false, "Only download PDFs (can be used alongside -graph)")
png := flag.Bool("png", false, "Only download best binarised png files")
verbose := flag.Bool("v", false, "Verbose")
flag.Usage = func() {
@@ -113,6 +114,18 @@ func main() {
if *pdf {
getpdfs(conn, verboselog, bookname)
+ }
+
+ if *graph {
+ fn := filepath.Join(bookname, "graph.png")
+ verboselog.Println("Downloading file", fn)
+ err = conn.Download(conn.WIPStorageId(), fn, fn)
+ if err != nil {
+ log.Fatalln("Failed to download file", fn, err)
+ }
+ }
+
+ if *pdf || *graph {
return
}