-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathapi_cmd.go
48 lines (38 loc) · 986 Bytes
/
api_cmd.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package dataset
import (
"flag"
"fmt"
"io"
)
// ApiDisplayUsage displays a usage message.
func ApiDisplayUsage(out io.Writer, appName string, flagSet *flag.FlagSet) {
// Replacable text vars
description := `
USAGE
=====
{app_name} SETTINGS_JSON_FILE
DESCRIPTION
--------
Runs a web service for one or more dataset collections. Requires
the collections to exist (e.g. created previously with the dataset
cli). It requires a settings JSON file that decribes the web service
configuration and permissions per collection that are available via
the web service.
EXAMPLE
-------
Starting up the web service
` + "```" + `
{app_name} settings.json
` + "```" + `
`
m := map[string]string{
"{app_name}": appName,
"{version}": Version,
}
// Convert {app_name} and {version} in description
fmt.Fprint(out, StringProcessor(m, description))
flagSet.SetOutput(out)
flagSet.PrintDefaults()
fmt.Fprint(out, StringProcessor(m, examples))
DisplayLicense(out, appName)
}