cmd

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = common.StandardCommand(&cobra.Command{
	Use:   "ak",
	Short: "autokitteh command-line interface and local server",

	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {

		if json {
			common.SetRenderer(common.JSONRenderer)
		}
		if niceJSON {
			common.SetRenderer(common.NiceJSONRenderer)
		}

		path := filepath.Join(xdg.ConfigHomeDir(), ".env")
		if err := godotenv.Load(path); err != nil {
			if !errors.Is(err, os.ErrNotExist) {
				return fmt.Errorf(".env loading error: %w", err)
			}
		}

		confmap, err := parseConfigs(configs)
		if err != nil {
			return err
		}

		if err := common.InitConfig(confmap); err != nil {
			return fmt.Errorf("root init config: %w", err)
		}

		return common.InitRPCClient(token)
	},
})

Functions

func Execute

func Execute()

Execute is the central point to run any command with corresponding parameters and flags, and to handle errors in a standard way. This is called only once by [main.main].

Types

type Version

type Version struct {
	Version   string           `json:"version"`
	Commit    string           `json:"commit,omitempty"`
	Date      string           `json:"date,omitempty"`
	User      string           `json:"user,omitempty"`
	Host      string           `json:"host,omitempty"`
	BuildInfo *debug.BuildInfo `json:"buildinfo,omitempty"`
}

func (Version) String

func (v Version) String() string

Jump to

Keyboard shortcuts

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