Reorder command flag and add missing flags (#1394)
This commit is contained in:
@@ -31,8 +31,8 @@ func Commands() *cobra.Command {
|
||||
}
|
||||
wrapper.SetFlags(createCmd, flag.FlagSet{
|
||||
Required: []flag.Flag{flag.HtUrl, flag.HtFnName},
|
||||
Optional: []flag.Flag{flag.HtName, flag.HtMethod, flag.HtIngressRule,
|
||||
flag.HtIngressAnnotation, flag.HtIngressTLS, flag.HtIngress,
|
||||
Optional: []flag.Flag{flag.HtName, flag.HtMethod, flag.HtIngress,
|
||||
flag.HtIngressRule, flag.HtIngressAnnotation, flag.HtIngressTLS,
|
||||
flag.HtFnWeight, flag.HtHost, flag.NamespaceFunction, flag.SpecSave},
|
||||
})
|
||||
|
||||
@@ -54,9 +54,9 @@ func Commands() *cobra.Command {
|
||||
}
|
||||
wrapper.SetFlags(updateCmd, flag.FlagSet{
|
||||
Required: []flag.Flag{flag.HtName},
|
||||
Optional: []flag.Flag{flag.NamespaceTrigger, flag.HtFnName, flag.HtUrl,
|
||||
flag.HtMethod, flag.HtIngressRule, flag.HtIngressAnnotation,
|
||||
flag.HtIngressTLS, flag.HtIngress, flag.HtFnWeight, flag.HtHost},
|
||||
Optional: []flag.Flag{flag.HtUrl, flag.HtFnName,
|
||||
flag.HtMethod, flag.HtIngress, flag.HtIngressRule, flag.HtIngressAnnotation,
|
||||
flag.HtIngressTLS, flag.HtFnWeight, flag.HtHost, flag.NamespaceTrigger},
|
||||
})
|
||||
|
||||
deleteCmd := &cobra.Command{
|
||||
@@ -72,7 +72,8 @@ func Commands() *cobra.Command {
|
||||
listCmd := &cobra.Command{
|
||||
Use: "list",
|
||||
Aliases: []string{},
|
||||
Short: "List all HTTP triggers in a namespace if specified, else, list HTTP triggers across all namespaces",
|
||||
Short: "List HTTP triggers",
|
||||
Long: "List all HTTP triggers in a namespace if specified, else, list HTTP triggers across all namespaces",
|
||||
RunE: wrapper.Wrapper(List),
|
||||
}
|
||||
wrapper.SetFlags(listCmd, flag.FlagSet{
|
||||
|
||||
@@ -74,7 +74,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
|
||||
triggerName := input.String(flagkey.HtName)
|
||||
// just name triggers by uuid.
|
||||
if triggerName == "" {
|
||||
if len(triggerName) == 0 {
|
||||
console.Warn(fmt.Sprintf("--%v will be soon marked as required flag, see 'help' for details", flagkey.HtName))
|
||||
triggerName = uuid.NewV4().String()
|
||||
}
|
||||
|
||||
@@ -66,6 +66,14 @@ func (opts *UpdateSubCommand) complete(input cli.Input) error {
|
||||
return errors.Wrap(err, "error getting HTTP trigger")
|
||||
}
|
||||
|
||||
if input.IsSet(flagkey.HtUrl) {
|
||||
ht.Spec.RelativeURL = input.String(flagkey.HtUrl)
|
||||
}
|
||||
|
||||
if input.IsSet(flagkey.HtMethod) {
|
||||
ht.Spec.Method = input.String(flagkey.HtMethod)
|
||||
}
|
||||
|
||||
if input.IsSet(flagkey.HtFnName) {
|
||||
// get the functions and their weights if specified
|
||||
functionList := input.StringSlice(flagkey.HtFnName)
|
||||
|
||||
Reference in New Issue
Block a user