cmd

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:     "crate",
	Short:   "Crate open source CLI",
	Version: Version,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {

		if cmd.Name() == "update" || cmd.Name() == "install" || cmd.Name() == "run" {
			return
		}

		lastCheck := cli.GetLastCheck()

		if time.Since(lastCheck) > 24*time.Hour {
			release, err := updater.CheckForUpdate(Version)
			if err == nil && release != nil {
				fmt.Printf("\n✨ A new version of crate is available! (%s)\n👉 Run `crate update` to install it.\n\n", release.TagName)
			}

			_ = cli.UpdateLastCheck(time.Now())
		}
	},
}
View Source
var (
	Version = "dev"
)

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately.

func ResolveEndpoint

func ResolveEndpoint() string

ResolveEndpoint returns the appropriate API endpoint based on flags

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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