version

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VersionCmd = &cobra.Command{
	Use:          "version",
	Short:        "Get the Arcane server version",
	SilenceUsage: true,
	RunE: func(cmd *cobra.Command, args []string) error {
		logger.GetLogger().Debug("Fetching server version")

		c, err := client.NewFromConfig()
		if err != nil {
			return err
		}

		logger.GetLogger().Debug("Sending request to ", clitypes.Endpoints.VersionEndpoint)
		resp, err := c.Get(cmd.Context(), clitypes.Endpoints.VersionEndpoint)
		if err != nil {
			return fmt.Errorf("failed to get version: %w", err)
		}
		defer func() { _ = resp.Body.Close() }()

		logger.GetLogger().Debugf("Response status: %s", resp.Status)

		body, err := io.ReadAll(resp.Body)
		if err != nil {
			return fmt.Errorf("failed to read response: %w", err)
		}

		logger.GetLogger().Debugf("Raw response: %s", string(body))

		var result version.Info

		if err := json.Unmarshal(body, &result); err != nil {
			return fmt.Errorf("failed to parse response: %w", err)
		}

		logger.GetLogger().Debugf("Parsed version data: %+v", result)

		output.Header("Arcane Environment Details: \n")

		output.KeyValue("Version", result.DisplayVersion)
		if result.Revision != "" {
			output.KeyValue("Revision", result.Revision)
		}
		if result.UpdateAvailable {
			output.Warning("Update available! New version: %s", result.NewestVersion)
			if result.ReleaseURL != "" {
				output.Info("Download at: %s", result.ReleaseURL)
			}
		}

		return nil
	},
}

VersionCmd gets the server version

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