mirror of https://github.com/dapr/cli.git
parent
378e047add
commit
2495648629
|
@ -86,6 +86,8 @@ func newCompletionBashCmd() *cobra.Command {
|
|||
},
|
||||
}
|
||||
|
||||
cmd.Flags().BoolP("help", "h", false, "Print this help message")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
|
@ -97,6 +99,7 @@ func newCompletionZshCmd() *cobra.Command {
|
|||
RootCmd.GenZshCompletion(os.Stdout)
|
||||
},
|
||||
}
|
||||
cmd.Flags().BoolP("help", "h", false, "Print this help message")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
@ -109,6 +112,7 @@ func newCompletionPowerShellCmd() *cobra.Command {
|
|||
RootCmd.GenPowerShellCompletion(os.Stdout)
|
||||
},
|
||||
}
|
||||
cmd.Flags().BoolP("help", "h", false, "Print this help message")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
|
|
@ -156,6 +156,6 @@ func init() {
|
|||
DashboardCmd.Flags().BoolVarP(&dashboardVersion, "version", "v", false, "Print the version for Dapr dashboard")
|
||||
DashboardCmd.Flags().IntVarP(&dashboardLocalPort, "port", "p", defaultLocalPort, "The local port on which to serve Dapr dashboard")
|
||||
DashboardCmd.Flags().StringVarP(&dashboardNamespace, "namespace", "n", daprSystemNamespace, "The namespace where Dapr dashboard is running")
|
||||
DashboardCmd.Flags().BoolP("help", "h", false, "Prints this help message")
|
||||
DashboardCmd.Flags().BoolP("help", "h", false, "Print this help message")
|
||||
RootCmd.AddCommand(DashboardCmd)
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ const defaultHTTPVerb = http.MethodPost
|
|||
var (
|
||||
invokeAppID string
|
||||
invokeAppMethod string
|
||||
invokePayload string
|
||||
invokeData string
|
||||
invokeVerb string
|
||||
)
|
||||
|
||||
|
@ -29,7 +29,7 @@ var InvokeCmd = &cobra.Command{
|
|||
Short: "Invoke a method on a given Dapr application",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
client := standalone.NewClient()
|
||||
response, err := client.Invoke(invokeAppID, invokeAppMethod, invokePayload, invokeVerb)
|
||||
response, err := client.Invoke(invokeAppID, invokeAppMethod, invokeData, invokeVerb)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("error invoking app %s: %s", invokeAppID, err)
|
||||
print.FailureStatusEvent(os.Stdout, err.Error())
|
||||
|
@ -46,7 +46,7 @@ var InvokeCmd = &cobra.Command{
|
|||
func init() {
|
||||
InvokeCmd.Flags().StringVarP(&invokeAppID, "app-id", "a", "", "The application id to invoke")
|
||||
InvokeCmd.Flags().StringVarP(&invokeAppMethod, "method", "m", "", "The method to invoke")
|
||||
InvokeCmd.Flags().StringVarP(&invokePayload, "payload", "p", "", "The JSON payload (optional)")
|
||||
InvokeCmd.Flags().StringVarP(&invokeData, "data", "d", "", "The JSON serialized data string (optional)")
|
||||
InvokeCmd.Flags().StringVarP(&invokeVerb, "verb", "v", defaultHTTPVerb, "The HTTP verb to use")
|
||||
InvokeCmd.Flags().BoolP("help", "h", false, "Print this help message")
|
||||
InvokeCmd.MarkFlagRequired("app-id")
|
||||
|
|
|
@ -37,8 +37,8 @@ var PublishCmd = &cobra.Command{
|
|||
|
||||
func init() {
|
||||
PublishCmd.Flags().StringVarP(&publishTopic, "topic", "t", "", "The topic to be published to")
|
||||
PublishCmd.Flags().StringVarP(&publishPayload, "data", "d", "", "The JSON serialized string (optional)")
|
||||
PublishCmd.Flags().StringVarP(&pubsubName, "pubsub", "", "", "The name of the pub/sub component")
|
||||
PublishCmd.Flags().StringVarP(&publishPayload, "data", "d", "", "The JSON serialized data string (optional)")
|
||||
PublishCmd.Flags().StringVarP(&pubsubName, "pubsub", "p", "", "The name of the pub/sub component")
|
||||
PublishCmd.Flags().BoolP("help", "h", false, "Print this help message")
|
||||
PublishCmd.MarkFlagRequired("app-id")
|
||||
PublishCmd.MarkFlagRequired("topic")
|
||||
|
|
|
@ -268,7 +268,7 @@ Run sidecar only:
|
|||
|
||||
func init() {
|
||||
RunCmd.Flags().IntVarP(&appPort, "app-port", "p", -1, "The port your application is listening on")
|
||||
RunCmd.Flags().StringVarP(&appID, "app-id", "i", "", "The id for your application, used for service discovery")
|
||||
RunCmd.Flags().StringVarP(&appID, "app-id", "a", "", "The id for your application, used for service discovery")
|
||||
RunCmd.Flags().StringVarP(&configFile, "config", "c", standalone.DefaultConfigFilePath(), "Dapr configuration file")
|
||||
RunCmd.Flags().IntVarP(&port, "dapr-http-port", "H", -1, "The HTTP port for Dapr to listen on")
|
||||
RunCmd.Flags().IntVarP(&grpcPort, "dapr-grpc-port", "G", -1, "The gRPC port for Dapr to listen on")
|
||||
|
|
|
@ -34,7 +34,7 @@ var StopCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
func init() {
|
||||
StopCmd.Flags().StringVarP(&stopAppID, "app-id", "", "", "The application id to be stopped")
|
||||
StopCmd.Flags().StringVarP(&stopAppID, "app-id", "a", "", "The application id to be stopped")
|
||||
StopCmd.Flags().BoolP("help", "h", false, "Print this help message")
|
||||
RootCmd.AddCommand(StopCmd)
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ type daprProcess struct {
|
|||
// Client is the interface the wraps all the methods exposed by the Dapr CLI.
|
||||
type Client interface {
|
||||
// Invoke is a command to invoke a remote or local dapr instance
|
||||
Invoke(appID, method, payload, verb string) (string, error)
|
||||
Invoke(appID, method, data, verb string) (string, error)
|
||||
// Publish is used to publish event to a topic in a pubsub.
|
||||
Publish(topic, payload, pubsubName string) error
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
)
|
||||
|
||||
// Invoke is a command to invoke a remote or local dapr instance.
|
||||
func (s *Standalone) Invoke(appID, method, payload, verb string) (string, error) {
|
||||
func (s *Standalone) Invoke(appID, method, data, verb string) (string, error) {
|
||||
list, err := s.process.List()
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
@ -27,8 +27,8 @@ func (s *Standalone) Invoke(appID, method, payload, verb string) (string, error)
|
|||
url := makeEndpoint(lo, method)
|
||||
var body io.Reader
|
||||
|
||||
if payload != "" {
|
||||
body = bytes.NewBuffer([]byte(payload))
|
||||
if data != "" {
|
||||
body = bytes.NewBuffer([]byte(data))
|
||||
}
|
||||
req, err := http.NewRequest(verb, url, body)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue