We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5ce1251 commit 96a798cCopy full SHA for 96a798c
cli/cdsctl/application_variable.go
@@ -30,9 +30,9 @@ var applicationVariableCreateCmd = cli.Command{
30
{Name: _ApplicationName},
31
},
32
Args: []cli.Arg{
33
- {Name: "variable-name", Weight: 1},
34
- {Name: "variable-type", Weight: 2},
35
- {Name: "variable-value", Weight: 3},
+ {Name: "variable-name"},
+ {Name: "variable-type"},
+ {Name: "variable-value"},
36
37
}
38
@@ -102,10 +102,10 @@ var applicationVariableUpdateCmd = cli.Command{
102
103
104
105
- {Name: "variable-oldname", Weight: 1},
106
- {Name: "variable-name", Weight: 2},
107
- {Name: "variable-type", Weight: 3},
108
- {Name: "variable-value", Weight: 4},
+ {Name: "variable-oldname"},
109
110
111
cli/cdsctl/workflow_log.go
@@ -65,7 +65,6 @@ var workflowLogListCmd = cli.Command{
65
match, _ := regexp.MatchString(`[0-9]?`, s)
66
return match
67
68
- Weight: 1,
69
70
71
@@ -196,7 +195,6 @@ var workflowLogDownloadCmd = cli.Command{
196
195
197
198
199
200
201
202
Flags: []cli.Flag{
cli/cdsctl/workflow_run_history.go
@@ -20,15 +20,13 @@ var workflowHistoryCmd = cli.Command{
20
21
22
23
24
25
{
26
Name: "limit",
27
IsValid: func(s string) bool {
28
29
- Weight: 2,
cli/cdsctl/workflow_stop.go
@@ -20,12 +20,10 @@ cdsctl workflow stop MYPROJECT myworkflow 5 compile # To stop a workflow node ru
OptionalArgs: []cli.Arg{
- Name: "run-number",
+ Name: "run-number",
- Name: "node-name",
+ Name: "node-name",
cli/cobra.go
@@ -87,9 +87,6 @@ func newCommand(c Command, run interface{}, subCommands SubCommands, mods ...Com
87
cmd.SetOutput(os.Stdout)
88
cmd.Use = c.Name
89
90
- sort.Sort(orderArgs(c.Args...))
91
- sort.Sort(orderArgs(c.OptionalArgs...))
92
-
93
if len(c.Ctx) > 0 {
94
cmd.Use = cmd.Use + " ["
95
@@ -138,7 +135,6 @@ func newCommand(c Command, run interface{}, subCommands SubCommands, mods ...Com
138
135
139
136
definedArgs := append(c.Ctx, c.Args...)
140
137
definedArgs = append(definedArgs, c.OptionalArgs...)
141
- sort.Sort(orderArgs(definedArgs...))
142
definedArgs = append(definedArgs, c.VariadicArgs)
143
144
cmd.Short = c.Short
cli/types.go
@@ -3,7 +3,6 @@ package cli
3
import (
4
"fmt"
5
"reflect"
6
- "sort"
7
"strconv"
8
"strings"
9
@@ -83,39 +82,9 @@ func (v *Values) GetStringArray(s string) []string {
83
82
type Arg struct {
84
Name string
85
IsValid func(string) bool
86
- Weight int
AllowEmpty bool
-func orderArgs(a ...Arg) args {
- for i := range a {
- if a[i].Weight == 0 {
- a[i].Weight = i
- }
96
- res := args(a)
97
- sort.Sort(res)
98
- return res
99
-}
100
101
-type args []Arg
-// Len is the number of elements in the collection.
-func (s args) Len() int {
- return len(s)
-// Less reports whether the element with
-// index i should sort before the element with index j.
-func (s args) Less(i, j int) bool {
- return s[i].Weight < s[j].Weight
112
113
114
-// Swap swaps the elements with indexes i and j.
115
-func (s args) Swap(i, j int) {
116
- s[i], s[j] = s[j], s[i]
117
118
119
// Command represents the way to instantiate a cobra.Command
120
type Command struct {
121
0 commit comments