9956: Show list of supported volume types.
authorTom Clegg <tom@curoverse.com>
Mon, 17 Oct 2016 08:27:55 +0000 (04:27 -0400)
committerTom Clegg <tom@curoverse.com>
Mon, 17 Oct 2016 08:28:07 +0000 (04:28 -0400)
services/keepstore/usage.go

index c067ec090be73b6b9ac69a3ef282bc122f8e6884..29f89f567d7b64729d10ecde3a4699186f233711 100644 (file)
@@ -4,19 +4,25 @@ import (
        "flag"
        "fmt"
        "os"
+       "sort"
+       "strings"
 
        "github.com/ghodss/yaml"
 )
 
 func usage() {
        c := DefaultConfig()
+       knownTypes := []string{}
        for _, vt := range VolumeTypes {
                c.Volumes = append(c.Volumes, vt().Examples()...)
+               knownTypes = append(knownTypes, vt().Type())
        }
        exampleConfigFile, err := yaml.Marshal(c)
        if err != nil {
                panic(err)
        }
+       sort.Strings(knownTypes)
+       knownTypeList := strings.Join(knownTypes, ", ")
        fmt.Fprintf(os.Stderr, `
 
 keepstore provides a content-addressed data store backed by a local filesystem or networked storage.
@@ -110,5 +116,9 @@ Volumes:
     use all directories named "keep" that exist in the top level
     directory of a mount point at startup time.
 
-`, exampleConfigFile)
+    Volume types: %s
+
+    (See volume configuration examples above.)
+
+`, exampleConfigFile, knownTypeList)
 }