space

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SpaceDescriptionCmd = &cobra.Command{
	Use:   `set-description <description>`,
	Short: "Set the description of the space",
	Long:  `Allows the description of the space to be set from the agent command line, this is useful for allowing the description to be set from a script running within the space.`,
	Args:  cobra.ExactArgs(1),
	PreRun: func(cmd *cobra.Command, args []string) {
		viper.BindPFlag("agent.api_port", cmd.Flags().Lookup("api-port"))
		viper.BindEnv("agent.api_port", config.CONFIG_ENV_PREFIX+"_LOGS_PORT")
		viper.SetDefault("agent.api_port", 12201)
	},
	Run: func(cmd *cobra.Command, args []string) {
		client := rest.NewClient("http://127.0.0.1:"+fmt.Sprint(viper.GetInt("agent.api_port")), "", true)

		_, err := client.SendData(http.MethodPost, "/api/space/description", agent_service_api.SpaceDescription{
			Message: args[0],
		}, nil, 200)
		if err != nil {
			fmt.Println("Error setting space description: ", err)
			os.Exit(1)
		}

		fmt.Println("Space description set.")
	},
}

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