diff options
author | Nick White <git@njw.name> | 2020-03-09 12:42:06 +0000 |
---|---|---|
committer | Nick White <git@njw.name> | 2020-03-09 12:42:06 +0000 |
commit | 62f8106c346ac8b631c82fd3546da67146d4262e (patch) | |
tree | 16210370c86faad34c661c2b2ab585d80d9d655c | |
parent | 41d78ce4a74b41a291d4042b5d9c277f2a111a7a (diff) |
Add nobooks flag to lspipeline so it has a faster mode
-rw-r--r-- | cmd/lspipeline/main.go | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/cmd/lspipeline/main.go b/cmd/lspipeline/main.go index 02119d1..5143e29 100644 --- a/cmd/lspipeline/main.go +++ b/cmd/lspipeline/main.go @@ -15,7 +15,7 @@ import ( "rescribe.xyz/bookpipeline" ) -const usage = `Usage: lspipeline [-i key] [-n num] +const usage = `Usage: lspipeline [-i key] [-n num] [-nobooks] Lists useful things related to the pipeline. @@ -194,6 +194,7 @@ func getRecentSSHLogsChan(ips []string, id string, lognum int, logs chan string) func main() { keyfile := flag.String("i", "", "private key file for SSH") lognum := flag.Int("n", 5, "number of lines to include in SSH logs") + nobooks := flag.Bool("nobooks", false, "disable listing books completed and not completed (which takes some time)") flag.Usage = func() { fmt.Fprintf(flag.CommandLine.Output(), usage) flag.PrintDefaults() @@ -219,7 +220,9 @@ func main() { go getInstances(conn, instances) go getQueueDetails(conn, queues) - go getBookStatusChan(conn, inprogress, done) + if !*nobooks { + go getBookStatusChan(conn, inprogress, done) + } var ips []string @@ -248,20 +251,22 @@ func main() { fmt.Printf("%s: %s available, %s in progress\n", i.name, i.numAvailable, i.numInProgress) } - fmt.Println("\n# Books not completed") - for i := range inprogress { - fmt.Println(i) - } - - fmt.Println("\n# Books done") - for i := range done { - fmt.Println(i) - } - if len(ips) > 0 { fmt.Println("\n# Recent logs") for i := range logs { fmt.Printf("\n%s", i) } } + + if !*nobooks { + fmt.Println("\n# Books not completed") + for i := range inprogress { + fmt.Println(i) + } + + fmt.Println("\n# Books done") + for i := range done { + fmt.Println(i) + } + } } |