This repository was archived by the owner on Jan 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-12
lines changed Expand file tree Collapse file tree 2 files changed +17
-12
lines changed Original file line number Diff line number Diff line change 88 "github.com/spf13/cobra"
99)
1010
11- func parseRootCmd (e * env ) * cobra.Command {
11+ func parseRootCmd (e * env ) ([] string , * cobra.Command ) {
1212 c := & cobra.Command {
1313 Use : "parse" ,
1414 Long : fmt .Sprintf (
@@ -45,7 +45,7 @@ http://parse.com`,
4545 c .AddCommand (newVersionCmd (e ))
4646
4747 if len (os .Args ) <= 1 {
48- return c
48+ return nil , c
4949 }
5050
5151 commands := []string {"help" }
@@ -61,5 +61,5 @@ http://parse.com`,
6161 }
6262 c .SetArgs (args )
6363
64- return c
64+ return args , c
6565}
Original file line number Diff line number Diff line change @@ -100,19 +100,24 @@ func main() {
100100 }
101101 e .ParseAPIClient = apiClient
102102
103- var rootCmd * cobra.Command
103+ var (
104+ rootCmd * cobra.Command
105+ command []string
106+ )
104107 switch e .Type {
105108 case legacyParseFormat , parseFormat :
106- rootCmd = parseRootCmd (& e )
109+ command , rootCmd = parseRootCmd (& e )
107110 }
108111
109- message , err := checkIfSupported (& e , version , os .Args [1 :]... )
110- if err != nil {
111- fmt .Fprintln (e .Err , err )
112- os .Exit (1 )
113- }
114- if message != "" {
115- fmt .Fprintln (e .Err , message )
112+ if len (command ) == 0 || command [0 ] != "update" {
113+ message , err := checkIfSupported (& e , version , command ... )
114+ if err != nil {
115+ fmt .Fprintln (e .Err , err )
116+ os .Exit (1 )
117+ }
118+ if message != "" {
119+ fmt .Fprintln (e .Err , message )
120+ }
116121 }
117122
118123 if err := rootCmd .Execute (); err != nil {
You can’t perform that action at this time.
0 commit comments