forked from raystack/optimus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
commands.go
78 lines (70 loc) · 2.39 KB
/
commands.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package cmd
import (
"github.com/MakeNowJust/heredoc"
"github.com/goto/salt/cmdx"
cli "github.com/spf13/cobra"
"github.com/goto/optimus/client/cmd/backup"
"github.com/goto/optimus/client/cmd/extension"
"github.com/goto/optimus/client/cmd/initialize"
"github.com/goto/optimus/client/cmd/job"
"github.com/goto/optimus/client/cmd/namespace"
"github.com/goto/optimus/client/cmd/playground"
"github.com/goto/optimus/client/cmd/plugin"
"github.com/goto/optimus/client/cmd/project"
"github.com/goto/optimus/client/cmd/replay"
"github.com/goto/optimus/client/cmd/resource"
"github.com/goto/optimus/client/cmd/scheduler"
"github.com/goto/optimus/client/cmd/secret"
"github.com/goto/optimus/client/cmd/version"
)
// New constructs the 'root' command. It houses all other sub commands
// default output of logging should go to stdout
// interactive output like progress bars should go to stderr
// unless the stdout/err is a tty, colors/progressbar should be disabled
func New() *cli.Command {
cmd := &cli.Command{
Use: "optimus <command> <subcommand> [flags]",
Long: heredoc.Doc(`
Optimus is an easy-to-use, reliable, and performant workflow orchestrator for
data transformation, data modeling, pipelines, and data quality management.
For passing authentication header, set one of the following environment
variables:
1. OPTIMUS_AUTH_BASIC_TOKEN
2. OPTIMUS_AUTH_BEARER_TOKEN`),
SilenceUsage: true,
Example: heredoc.Doc(`
$ optimus job create
$ optimus backup create
$ optimus backup list
`),
Annotations: map[string]string{
"group:core": "true",
"help:learn": heredoc.Doc(`
Use 'optimus <command> <subcommand> --help' for more information about a command.
Read the manual at https://goto.github.io/optimus/
`),
"help:feedback": heredoc.Doc(`
Open an issue here https://github.com/goto/optimus/issues
`),
},
}
cmdx.SetHelp(cmd)
// Client related commands
cmd.AddCommand(
backup.NewBackupCommand(),
initialize.NewInitializeCommand(),
job.NewJobCommand(),
namespace.NewNamespaceCommand(),
project.NewProjectCommand(),
resource.NewResourceCommand(),
secret.NewSecretCommand(),
version.NewVersionCommand(),
playground.NewPlaygroundCommand(),
scheduler.NewSchedulerCommand(),
replay.NewReplayCommand(),
// Will decide later, to add it server side or not
plugin.NewPluginCommand(),
)
extension.UpdateWithExtension(cmd)
return cmd
}