commands

package
v1.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetSessionCmd = &cobra.Command{
	Use:   "get-session [name]",
	Short: "Get information about a session",
	Args:  cobra.ExactArgs(1),
	RunE: func(cmd *cobra.Command, args []string) error {
		client := sessionv1connect.NewSessionServiceClient(
			http.DefaultClient,
			"http://localhost:8080",
		)
		req := &connect.Request[sessionv1.GetSessionRequest]{
			Msg: &sessionv1.GetSessionRequest{
				Id: args[0],
			},
		}
		resp, err := client.GetSession(context.Background(), req)
		if err != nil {
			return fmt.Errorf("could not get session: %w", err)
		}

		jsonData, err := json.MarshalIndent(resp.Msg.Session, "", "  ")
		if err != nil {
			return fmt.Errorf("could not marshal session data to json: %w", err)
		}
		fmt.Println(string(jsonData))

		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL