-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
72 lines (67 loc) · 2.64 KB
/
Copy pathmain.go
File metadata and controls
72 lines (67 loc) · 2.64 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package main // import "github.com/finkf/pcwclient"
import (
"github.com/spf13/cobra"
)
var mainCommand = &cobra.Command{
Use: "pcwclient",
Short: "Command line client for pocoweb",
Long: `
Command line client for pocoweb. You can use it to automate or test
the pocoweb post-correction.
In order to use the command line client, you should use the
POCOWEB_URL and POCOWEB_AUTH environment varibales to set the url and
the authentification token respectively or use the appropriate --url
and --auth parameters accordingly.`,
}
func init() {
mainCommand.AddCommand(&listCommand)
mainCommand.AddCommand(&newCommand)
mainCommand.AddCommand(&loginCommand)
mainCommand.AddCommand(&logoutCommand)
mainCommand.AddCommand(&printCommand)
mainCommand.AddCommand(&versionCommand)
mainCommand.AddCommand(&searchCommand)
mainCommand.AddCommand(&correctCommand)
mainCommand.AddCommand(&downloadCommand)
mainCommand.AddCommand(&pkgCommand)
downloadCommand.AddCommand(&downloadBookCommand)
downloadCommand.AddCommand(&downloadPoolCommand)
pkgCommand.AddCommand(&pkgAssignCommand)
pkgCommand.AddCommand(&pkgReassignCommand)
pkgCommand.AddCommand(&pkgSplitCommand)
mainCommand.AddCommand(&deleteCommand)
mainCommand.AddCommand(&startCommand)
listCommand.AddCommand(&listBooksCommand)
listCommand.AddCommand(&listUsersCommand)
listCommand.AddCommand(&listPatternsCommand)
listCommand.AddCommand(&listSuggestionsCommand)
listCommand.AddCommand(&listSuspiciousCommand)
listCommand.AddCommand(&listAdaptiveCommand)
listCommand.AddCommand(&listELCommand)
listCommand.AddCommand(&listRRDMCommand)
listCommand.AddCommand(&listCharsCommand)
newCommand.AddCommand(&newUserCommand)
newCommand.AddCommand(&newBookCommand)
startCommand.AddCommand(&startProfileCommand)
startCommand.AddCommand(&startELCommand)
startCommand.AddCommand(&startRRDMCommand)
deleteCommand.AddCommand(&deleteBooksCommand)
deleteCommand.AddCommand(&deleteUsersCommand)
mainCommand.SilenceUsage = true
mainCommand.SilenceErrors = true
mainCommand.PersistentFlags().BoolVarP(&opts.format.json, "json", "J", false,
"output raw json")
mainCommand.PersistentFlags().BoolVarP(&opts.skipVerify,
"skip-verify", "S", false, "ignore invalid ssl certificates")
mainCommand.PersistentFlags().BoolVarP(&opts.debug, "debug", "D", false,
"enable debug output")
mainCommand.PersistentFlags().StringVarP(&opts.pocowebURL, "url", "U",
getURL(), "set pocoweb url")
mainCommand.PersistentFlags().StringVarP(&opts.format.template, "format", "F",
"", "set output format")
mainCommand.PersistentFlags().StringVarP(&opts.authToken, "auth", "A",
getAuth(), "set auth token")
}
func main() {
chk(mainCommand.Execute())
}