cmd

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "0.7.1"

Version is the CLI version - single source of truth

Variables

View Source
var ConfigCmd = &cobra.Command{
	Use:   "config",
	Short: "Manage global CLI configuration",
	Long:  `Set, get, list, or reset global configuration defaults for velocity commands.`,
}
View Source
var InitCmd = &cobra.Command{
	Use:   "init",
	Short: "Initialize Velocity in existing Go project",
	Long:  `Add Velocity framework structure to an existing Go project while preserving all existing files.`,
	RunE:  runInit,
}
View Source
var KeyCmd = &cobra.Command{
	Use:   "key:generate",
	Short: "Generate a new application crypto key",
	Long:  "Generate a new 32-byte base64 encoded key and optionally update .env file",
	Run:   runKeyGenerate,
}
View Source
var NewCmd = &cobra.Command{
	Use:           "new [project-name]",
	Short:         "Create a new Velocity project",
	SilenceUsage:  true,
	SilenceErrors: true,
	Args: func(cmd *cobra.Command, args []string) error {
		if len(args) < 1 {
			ui.Error("Project name is required")
			ui.Newline()
			ui.Muted("Usage: velocity new [project-name]")
			ui.Newline()
			ui.Muted("Flags:")
			ui.Muted("  --database    Database driver (postgres, mysql, sqlite)")
			ui.Muted("  --cache       Cache driver (redis, memory)")
			ui.Muted("  --auth        Include authentication scaffolding")
			ui.Muted("  --api         API-only structure (no views)")
			return fmt.Errorf("")
		}
		return nil
	},
	Run: func(cmd *cobra.Command, args []string) {
		projectName := args[0]
		ui.Header("velocity new")

		config := generator.ProjectConfig{
			Name:     projectName,
			Module:   projectName,
			Database: database,
			Cache:    cache,
			Auth:     auth,
			API:      api,
		}

		if err := generator.CreateProject(config); err != nil {
			ui.Newline()
			ui.Error(err.Error())
			return
		}

		ui.Newline()
		ui.Info("Starting development servers")

		generator.StartDevServers(projectName)
	},
}
View Source
var UpgradeCmd = &cobra.Command{
	Use:   "upgrade",
	Short: "Update project's velocity-cli to match global CLI version",
	Long:  `Updates the velocity-cli dependency in your project's go.mod to match the globally installed CLI version.`,
	RunE:  runUpgrade,
}

UpgradeCmd updates the project's velocity-cli dependency to match the global CLI version

View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "Print version information",
	Run: func(cmd *cobra.Command, args []string) {
		w := cmd.OutOrStdout()
		fmt.Fprintln(w)

		fmt.Fprintln(w, colors.BrandStyle.Render("╔══════════════════════════════════════╗"))
		fmt.Fprintln(w, colors.BrandStyle.Render("║        VELOCITY CLI v"+Version+"        ║"))
		fmt.Fprintln(w, colors.BrandStyle.Render("╚══════════════════════════════════════╝"))
		fmt.Fprintln(w)
	},
}

Functions

func InitHelp

func InitHelp(root *cobra.Command)

InitHelp sets up custom help for the root command

Types

This section is empty.

Jump to

Keyboard shortcuts

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