MCPcopy Index your code
hub / github.com/rilldata/rill / PingCmd

Function PingCmd

cli/cmd/runtime/ping.go:13–41  ·  view source on GitHub ↗
(ch *cmdutil.Helper)

Source from the content-addressed store, hash-verified

11)
12
13func PingCmd(ch *cmdutil.Helper) *cobra.Command {
14 var runtimeURL string
15
16 pingCmd := &cobra.Command{
17 Use: "ping",
18 Short: "Ping",
19 RunE: func(cmd *cobra.Command, args []string) error {
20 client, err := client.New(runtimeURL, "")
21 if err != nil {
22 return err
23 }
24 defer client.Close()
25
26 ch.Printf("Ping: %s\n", time.Now().UTC().String())
27
28 pong, err := client.Ping(cmd.Context(), &runtimev1.PingRequest{})
29 if err != nil {
30 return err
31 }
32
33 fmt.Printf("Pong: %s\n", pong.Time.AsTime().String())
34 return nil
35 },
36 }
37
38 pingCmd.Flags().StringVar(&runtimeURL, "url", "http://localhost:49009", "Base URL for the runtime")
39
40 return pingCmd
41}

Callers 1

RuntimeCmdFunction · 0.70

Calls 6

NewFunction · 0.92
PrintfMethod · 0.80
CloseMethod · 0.65
StringMethod · 0.65
PingMethod · 0.65
ContextMethod · 0.65

Tested by

no test coverage detected