forked from jenkins-x/jx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd.go
85 lines (72 loc) · 2.28 KB
/
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
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
79
80
81
82
83
84
85
package cmd
import (
"io"
cmdutil "github.com/jenkins-x/jx/pkg/jx/cmd/util"
"github.com/spf13/cobra"
)
const (
// * runs (aka 'run')
valid_resources = `Valid resource types include:
* environments (aka 'env')
* pipelines (aka 'pipe')
* urls (aka 'url')
`
)
// NewJXCommand creates the `jx` command and its nested children.
func NewJXCommand(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cobra.Command {
cmds := &cobra.Command{
Use: "jx",
Short: "jx is a command line tool for working with Jenkins X",
Long: `
`,
Run: runHelp,
/*
BashCompletionFunction: bash_completion_func,
*/
}
/*
f.BindFlags(cmds.PersistentFlags())
f.BindExternalFlags(cmds.PersistentFlags())
// From this point and forward we get warnings on flags that contain "_" separators
cmds.SetGlobalNormalizationFunc(flag.WarnWordSepNormalizeFunc)
groups := templates.CommandGroups{
{
Message: "Basic Commands (Beginner):",
Commands: []*cobra.Command{
NewCmdCreate(f, out, err),
NewCmdExposeService(f, out),
NewCmdRun(f, in, out, err),
set.NewCmdSet(f, out, err),
},
},
*/
cmds.AddCommand(NewCmdCreateAddon(f, out, err))
cmds.AddCommand(NewCmdCompletion(f, out))
cmds.AddCommand(NewCmdContext(f, out, err))
cmds.AddCommand(NewCmdConsole(f, out, err))
cmds.AddCommand(NewCmdCreate(f, out, err))
cmds.AddCommand(NewCmdEdit(f, out, err))
cmds.AddCommand(NewCmdDelete(f, out, err))
cmds.AddCommand(NewCmdEnvironment(f, out, err))
cmds.AddCommand(NewCmdGet(f, out, err))
cmds.AddCommand(NewCmdImport(f, out, err))
cmds.AddCommand(NewCmdInit(f, out, err))
cmds.AddCommand(NewCmdInstall(f, out, err))
cmds.AddCommand(NewCmdLogs(f, out, err))
cmds.AddCommand(NewCmdMetrics(f, out, err))
cmds.AddCommand(NewCmdNamespace(f, out, err))
cmds.AddCommand(NewCmdOpen(f, out, err))
cmds.AddCommand(NewCmdPromote(f, out, err))
cmds.AddCommand(NewCmdPrompt(f, out, err))
cmds.AddCommand(NewCmdRsh(f, out, err))
cmds.AddCommand(NewCmdShell(f, out, err))
cmds.AddCommand(NewCmdStart(f, out, err))
cmds.AddCommand(NewCmdStep(f, out, err))
cmds.AddCommand(NewCmdUninstall(f, out, err))
cmds.AddCommand(NewCmdUpgrade(f, out, err))
cmds.AddCommand(NewCmdVersion(f, out, err))
return cmds
}
func runHelp(cmd *cobra.Command, args []string) {
cmd.Help()
}