cli

package
v0.0.0-...-8bef7c3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Overview

Package cli implements the blackdot command-line interface using Cobra.

Package cli output utilities Mirrors lib/_colors.sh and lib/_logging.sh from the Zsh implementation

Package cli implements the blackdot command-line interface using Cobra.

Commands mirror the existing Zsh implementation in bin/blackdot-* to ensure behavioral compatibility during migration.

Package cli provides custom help styling that matches the ZSH implementation.

Package cli implements the blackdot command-line interface using Cobra.

Package cli implements the blackdot command-line interface using Cobra.

Package cli implements the blackdot command-line interface using Cobra.

Package cli implements the blackdot command-line interface using Cobra.

Package cli implements the blackdot command-line interface using Cobra.

Package cli implements the blackdot command-line interface using Cobra.

Package cli implements the blackdot command-line interface using Cobra.

Package cli implements the blackdot command-line interface using Cobra.

Index

Constants

This section is empty.

Variables

View Source
var (
	Red     = color.New(color.FgRed)
	Green   = color.New(color.FgGreen)
	Yellow  = color.New(color.FgYellow)
	Blue    = color.New(color.FgBlue)
	Cyan    = color.New(color.FgCyan)
	Magenta = color.New(color.FgMagenta)
	Bold    = color.New(color.Bold)
	Dim     = color.New(color.Faint)
)

============================================================ Colors ============================================================

View Source
var (
	BoldCyan = color.New(color.Bold, color.FgCyan)
)

Combined styles

Functions

func BlackdotDir

func BlackdotDir() string

BlackdotDir returns the resolved blackdot directory path. NOTE: Returns "" if called before Cobra initialization completes. blackdotDir is populated by initConfig(), which is registered via cobra.OnInitialize and runs before any command's RunE function. Do not call BlackdotDir() from package init() or during import.

func ConfigDir

func ConfigDir() string

ConfigDir returns the config directory (~/.config/blackdot)

func Confirm

func Confirm(prompt string) bool

Confirm prompts for yes/no confirmation Returns true for yes, false for no

func Debug

func Debug(format string, a ...interface{})

Debug prints a debug message (only when verbose flag is set)

func DryRun

func DryRun(format string, a ...interface{})

DryRun prints a dry-run message (cyan)

func Execute

func Execute() error

Execute runs the root command

func Fail

func Fail(format string, a ...interface{})

Fail prints an error message (red)

func Info

func Info(format string, a ...interface{})

Info prints an informational message (blue)

func Pass

func Pass(format string, a ...interface{})

Pass prints a success message (green)

func PrintDeps

func PrintDeps(deps string)

PrintDeps prints dependencies in dim text with tree prefix

func PrintFeature

func PrintFeature(name, description string, enabled bool)

PrintFeature prints a feature with status icon and description

func PrintHeader

func PrintHeader(title string)

PrintHeader prints a bold section header with double-line border

func PrintHint

func PrintHint(format string, a ...interface{})

PrintHint prints a dim hint message

func PrintLegend

func PrintLegend()

PrintLegend prints the feature status legend

func PrintSubheader

func PrintSubheader(title string)

PrintSubheader prints a category subheader with single-line border

func SetVersionInfo

func SetVersionInfo(version, commit, date string)

SetVersionInfo sets version information from build flags

func StatusColor

func StatusColor(enabled bool) *color.Color

StatusColor returns the appropriate color for enabled/disabled state

func StatusIcon

func StatusIcon(enabled bool) string

StatusIcon returns the appropriate icon for enabled/disabled state

func Warn

func Warn(format string, a ...interface{})

Warn prints a warning message (yellow)

Types

type DevcontainerConfig

type DevcontainerConfig struct {
	Name              string                       `json:"name"`
	Image             string                       `json:"image,omitempty"`
	DockerComposeFile string                       `json:"dockerComposeFile,omitempty"`
	Service           string                       `json:"service,omitempty"`
	Features          map[string]map[string]string `json:"features"`
	PostStartCommand  string                       `json:"postStartCommand"`
	Customizations    *DevcontainerCustomizations  `json:"customizations,omitempty"`
	RemoteUser        string                       `json:"remoteUser,omitempty"`
	Mounts            []string                     `json:"mounts,omitempty"`
	ContainerEnv      map[string]string            `json:"containerEnv,omitempty"`
	WorkspaceFolder   string                       `json:"workspaceFolder,omitempty"`
}

DevcontainerConfig represents the generated devcontainer.json

type DevcontainerCustomizations

type DevcontainerCustomizations struct {
	VSCode *VSCodeCustomizations `json:"vscode,omitempty"`
}

type DevcontainerImage

type DevcontainerImage struct {
	Name        string
	Image       string
	Description string
	Extensions  []string // VS Code extensions to recommend
}

DevcontainerImage represents a base image option

type DevcontainerPreset

type DevcontainerPreset struct {
	Name        string
	Description string
}

DevcontainerPreset represents a blackdot preset option

type DevcontainerService

type DevcontainerService struct {
	Name          string
	Image         string
	Description   string
	Ports         []string          // Exposed ports
	Environment   map[string]string // Environment variables
	Volumes       []string          // Volume mounts
	EnvVars       map[string]string // Environment variables to set in app container
	Healthcheck   string            // Healthcheck command
	ConflictsWith []string          // Services this conflicts with (share same env vars)
}

DevcontainerService represents a supporting service (database, cache, etc.)

type DriftFileState

type DriftFileState struct {
	Path     string `json:"path"`
	Checksum string `json:"checksum"`
}

DriftFileState represents state for a single file

type DriftState

type DriftState struct {
	Timestamp string                    `json:"timestamp"`
	Hostname  string                    `json:"hostname"`
	Files     map[string]DriftFileState `json:"files"`
}

DriftState represents the cached vault state

type HookEntry

type HookEntry struct {
	Name     string `json:"name"`
	Command  string `json:"command,omitempty"`
	Script   string `json:"script,omitempty"`
	Function string `json:"function,omitempty"`
	Enabled  *bool  `json:"enabled,omitempty"`
	FailOk   bool   `json:"fail_ok,omitempty"`
}

HookEntry represents a single hook configuration

type HookSettings

type HookSettings struct {
	FailFast bool `json:"fail_fast"`
	Verbose  bool `json:"verbose"`
	Timeout  int  `json:"timeout"`
}

HookSettings represents hook system settings

type HooksConfig

type HooksConfig struct {
	Hooks    map[string][]HookEntry `json:"hooks"`
	Settings HookSettings           `json:"settings"`
}

HooksConfig represents the hooks.json configuration

type MetricEntry

type MetricEntry struct {
	Timestamp   string `json:"timestamp"`
	HealthScore int    `json:"health_score"`
	Errors      int    `json:"errors"`
	Warnings    int    `json:"warnings"`
	Fixed       int    `json:"fixed"`
	GitBranch   string `json:"git_branch"`
	GitCommit   string `json:"git_commit"`
	Hostname    string `json:"hostname"`
	OS          string `json:"os"`
}

MetricEntry represents a single health check metric

type PackagesConfig

type PackagesConfig struct {
	Tier string `json:"tier,omitempty"`
}

type PathsConfig

type PathsConfig struct {
	WorkspaceTarget string `json:"workspace_target,omitempty"`
}

type SetupConfig

type SetupConfig struct {
	Version  int                    `json:"version"`
	Setup    SetupState             `json:"setup"`
	Vault    VaultConfig            `json:"vault,omitempty"`
	Paths    PathsConfig            `json:"paths,omitempty"`
	Packages PackagesConfig         `json:"packages,omitempty"`
	Features map[string]bool        `json:"features,omitempty"`
	Extra    map[string]interface{} `json:"-"`
}

SetupConfig holds config for setup

type SetupState

type SetupState struct {
	Completed []string `json:"completed,omitempty"`
	Timestamp string   `json:"timestamp,omitempty"`
}

type SyncDirection

type SyncDirection string

SyncDirection represents the direction of sync

const (
	SyncInSync   SyncDirection = "in_sync"
	SyncPush     SyncDirection = "push"
	SyncPull     SyncDirection = "pull"
	SyncConflict SyncDirection = "conflict"
)

type VSCodeCustomizations

type VSCodeCustomizations struct {
	Extensions []string `json:"extensions,omitempty"`
}

type VaultConfig

type VaultConfig struct {
	Backend  string `json:"backend,omitempty"`
	LastSync string `json:"last_sync,omitempty"`
}

type VaultItem

type VaultItem struct {
	Path     string `json:"path"`
	Type     string `json:"type"`
	Required bool   `json:"required"`
}

VaultItem represents an item in vault-items.json

Jump to

Keyboard shortcuts

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