cmd

package
v1.11.1 Latest Latest
Warning

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

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

README

cmd

This package contains the command-line interface (CLI) implementation for KSail.

Purpose

Implements the CLI commands and user interface for KSail using the Cobra framework. This package provides the main entry point for all KSail operations through command-line interactions.

Structure

  • Root Command: root.go - Main CLI setup with Cobra framework and version handling
  • Command Implementations: Individual command files (init.go, cluster/, etc.)
  • UI Components: ui/ subdirectory containing user interface utilities
  • Internal Helpers: internal/ subdirectory containing command helper utilities

Available Commands

  • init - Initialize a new KSail project
  • cluster - Parent namespace for cluster lifecycle commands (up, down, start, stop, status, list)
  • workload - Namespace for workload-focused operations (reconcile, apply, install placeholders)

Features

  • Cobra Framework: Uses Cobra for consistent CLI structure and help generation
  • Colored Output: Colored terminal output for better user experience
  • Consistent UI: Standardized symbols and messaging across all commands
  • Help System: Comprehensive help and usage information for all commands

Subpackages

  • ui/asciiart/ - ASCII art and visual elements
  • ui/notify/ - User notification and messaging utilities
  • internal/cmdhelpers/ - Internal command helper utilities

Usage

The CLI is built and used as:

# Build the CLI
go build -o ksail .

# Use the CLI
./ksail --help
./ksail init --distribution Kind
./ksail cluster up
./ksail cluster status
./ksail cluster down
./ksail workload --help
./ksail workload reconcile

This package serves as the primary user interface for KSail, providing a comprehensive command-line experience for managing Kubernetes clusters and workloads.


⬅️ Go Back

Documentation

Overview

Package cmd provides the command-line interface for KSail.

This package contains all CLI commands and subcommands for the KSail application, including initialization, cluster management (up, down, start, stop, status, list), and other utility commands for working with local Kubernetes clusters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(cmd *cobra.Command) error

Execute runs the provided root command and handles errors.

func HandleInitRunE

func HandleInitRunE(
	cmd *cobra.Command,
	cfgManager *ksailconfigmanager.ConfigManager,
	deps InitDeps,
) error

HandleInitRunE handles the init command.

func NewInitCmd

func NewInitCmd(runtimeContainer *runtime.Runtime) *cobra.Command

NewInitCmd creates and returns the init command.

func NewRootCmd

func NewRootCmd(version, commit, date string) *cobra.Command

NewRootCmd creates and returns the root command with version info and subcommands.

Types

type InitDeps

type InitDeps struct {
	Timer timer.Timer
}

InitDeps captures dependencies required for the init command.

Directories

Path Synopsis
Package cluster groups all KSail cluster lifecycle Cobra commands under a single namespace.
Package cluster groups all KSail cluster lifecycle Cobra commands under a single namespace.
testutils
Package testutils provides shared helpers for cluster command tests.
Package testutils provides shared helpers for cluster command tests.
internal
shared
Package shared provides reusable helpers for command wiring.
Package shared provides reusable helpers for command wiring.
testutils
Package testutils provides testing helpers for command testing (command-layer specific).
Package testutils provides testing helpers for command testing (command-layer specific).
Package workload provides the workload command namespace.
Package workload provides the workload command namespace.

Jump to

Keyboard shortcuts

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