-
Notifications
You must be signed in to change notification settings - Fork 7
/
workload.go
41 lines (35 loc) · 1022 Bytes
/
workload.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
package command
import (
"github.com/mitchellh/cli"
"github.com/pkg/errors"
)
//Workload command
type Workload struct {
*command
}
//WorkloadFactory returns a factory method for the join command
func WorkloadFactory() (cli.Command, error) {
comm, err := newCommand("nerd workload <subcommand>", "control compute capacity for working on tasks", "", nil)
if err != nil {
return nil, errors.Wrap(err, "failed to create command")
}
cmd := &Workload{
command: comm,
}
cmd.runFunc = cmd.DoRun
return cmd, nil
}
//HelpTemplate provides a template for the help command, which excludes the "workload work" command
func (cmd *Workload) HelpTemplate() string {
return `
{{.Help}}{{if gt (len .Subcommands) 0}}
Subcommands:
{{- range $value := .Subcommands }}{{if ne "work" $value.Name}}
{{ $value.NameAligned }} {{ $value.Synopsis }}{{ end }}{{ end }}
{{- end }}
`
}
//DoRun is called by run and allows an error to be returned
func (cmd *Workload) DoRun(args []string) (err error) {
return errShowHelp
}