Skip to content

Commit

Permalink
change usage defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
maleck13 authored and sedroche committed Jan 26, 2018
1 parent 8d87f18 commit 4a0cb51
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 2 additions & 0 deletions cmd/mobile/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ func main() {
rootCmd.AddCommand(startCmd)
}

rootCmd.SilenceUsage = true

if err := rootCmd.Execute(); err != nil {
// as using pkg/errors lets allow the full stack to be seen if needed
if os.Getenv("MCP_DEBUG") == "true" {
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Run the "mobile get clients" command from this tool to get the client ID.`,
oc plugin mobile get client <clientID>`,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return errors.New("missing argument <clientID>")
return cmd.Usage()
}
clientID := args[0]
ns, err := currentNamespace(cmd.Flags())
Expand Down Expand Up @@ -140,7 +140,7 @@ When used standalone, a namespace must be specified by providing the --namespace

RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 3 {
return errors.New("expected a name a clientType and a appIdentifier")
return cmd.Usage()
}
name := args[0]
clientType := args[1]
Expand Down Expand Up @@ -217,7 +217,7 @@ Run the "mobile get clients" command from this tool to get the client ID.`,
var ns string

if len(args) != 1 {
return errors.New("expected a clientID argument to be passed " + cmd.Use)
return cmd.Usage()
}
clientID := args[0]

Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ oc plugin mobile create integration <consuming_service_instance_id> <providing_s
`,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) < 2 {
return errors.New("missing arguments: " + cmd.Use)
return cmd.Usage()
}
namespace, err := currentNamespace(cmd.Flags())
if err != nil {
Expand Down Expand Up @@ -185,7 +185,7 @@ oc plugin mobile delete integration <consuming_service_instance_id> <providing_s
`,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) < 2 {
return errors.New("missing arguments.")
return cmd.Usage()
}
namespace, err := currentNamespace(cmd.Flags())
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions pkg/cmd/serviceConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ func (scc *ServiceConfigCmd) GetServiceConfigCmd() *cobra.Command {
Short: "get a mobile aware service definition",
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
//log.Println(")
return errors.Errorf("%v\n%v", "service name is required", cmd.Usage())
return cmd.Usage()
}
serviceName := args[0]
if serviceName == "" {
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Run the "mobile get services" command from this tool to see which services are a
oc plugin mobile create serviceinstance <serviceName>`,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return errors.New("expected the name of a service to provision")
return cmd.Usage()
}
// find our serviceclass and plan
serviceName := args[0]
Expand Down Expand Up @@ -392,7 +392,7 @@ Run the "mobile get serviceinstances" command from this tool to see which servic
//delete service instance
//delete params secret
if len(args) != 1 {
return errors.New("expected a serviceInstanceID")
return cmd.Usage()
}
ns, err := currentNamespace(cmd.Flags())
if err != nil {
Expand Down Expand Up @@ -423,7 +423,7 @@ func (sc *ServicesCmd) ListServiceInstCmd() *cobra.Command {
oc plugin mobile get serviceinstances <serviceName>`,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return errors.New("no service name passed")
return cmd.Usage()
}
serviceName := args[0]
ns, err := currentNamespace(cmd.Flags())
Expand Down

0 comments on commit 4a0cb51

Please sign in to comment.