internal

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearLine

func ClearLine()

ClearLine clears the current line

func ClearScreen

func ClearScreen()

ClearScreen clears the terminal screen

func FileExists

func FileExists(path string) bool

func GetCommandVariants

func GetCommandVariants(command string) []string

func HandleCheckCommand

func HandleCheckCommand(r *CommandRunner) error

HandleCheckCommand handles the special 'check' command that runs lint, typecheck, and test

func HandleFixCommand

func HandleFixCommand(r *CommandRunner) error

HandleFixCommand handles the special 'fix' command that runs format/lint fixes

func HandleTypecheckCommand

func HandleTypecheckCommand(r *CommandRunner) error

HandleTypecheckCommand handles the special 'typecheck' command

func MoveCursorUp

func MoveCursorUp(n int)

MoveCursorUp moves the cursor up n lines

func NormalizeCommand

func NormalizeCommand(cmd string) string

func RunInteractive

func RunInteractive() error

RunInteractive starts the interactive command runner mode

Types

type BunSource

type BunSource struct {
	// contains filtered or unexported fields
}

BunSource for bun projects

func (*BunSource) FindCommand

func (n *BunSource) FindCommand(command string, args []string) *exec.Cmd

func (*BunSource) ListCommands

func (n *BunSource) ListCommands() map[string]CommandInfo

type CargoSource

type CargoSource struct {
	// contains filtered or unexported fields
}

CargoSource for Rust projects

func (*CargoSource) FindCommand

func (c *CargoSource) FindCommand(command string, args []string) *exec.Cmd

func (*CargoSource) ListCommands

func (c *CargoSource) ListCommands() map[string]CommandInfo

func (*CargoSource) Name

func (b *CargoSource) Name() string

func (*CargoSource) Priority

func (b *CargoSource) Priority() int

type CommandInfo

type CommandInfo struct {
	Description string // Human-readable description
	Execution   string // What will actually be executed
}

CommandInfo holds information about a command

type CommandRunner

type CommandRunner struct {
	Command     string
	Args        []string
	CurrentDir  string
	ProjectRoot string
}

func New

func New(command string, args []string) *CommandRunner

func (*CommandRunner) ExecuteCommand

func (r *CommandRunner) ExecuteCommand(cmd *exec.Cmd) error

func (*CommandRunner) FindProjectRoot

func (r *CommandRunner) FindProjectRoot(dir string) string

func (*CommandRunner) Init

func (r *CommandRunner) Init() error

func (*CommandRunner) ListCommands

func (r *CommandRunner) ListCommands()

ListCommands is the original method for backward compatibility

func (*CommandRunner) ListCommandsWithOptions

func (r *CommandRunner) ListCommandsWithOptions(showAll bool, verbose bool)

ListCommandsWithOptions shows available commands with configurable options

func (*CommandRunner) Run

func (r *CommandRunner) Run() error

type CommandSource

type CommandSource interface {
	// Name returns the display name for this source (e.g., "mise", "npm", "Poetry")
	Name() string

	// ListCommands returns all available commands with description and execution command
	// Returns a map of command name to CommandInfo
	ListCommands() map[string]CommandInfo

	// FindCommand looks for a specific command in this source
	// Returns nil if the command is not found
	FindCommand(command string, args []string) *exec.Cmd

	// Priority returns the priority of this source (lower numbers = higher priority)
	// This determines the order in which sources are checked
	Priority() int
}

CommandSource represents a source of commands (mise, just, make, package.json, etc.)

func NewBunSource

func NewBunSource(dir string) CommandSource

func NewCargoSource

func NewCargoSource(dir string) CommandSource

func NewDenoSource

func NewDenoSource(dir string) CommandSource

func NewGoSource

func NewGoSource(dir string) CommandSource

func NewGradleSource

func NewGradleSource(dir string) CommandSource

func NewJustSource

func NewJustSource(dir string) CommandSource

func NewMakeSource

func NewMakeSource(dir string) CommandSource

func NewMavenSource

func NewMavenSource(dir string) CommandSource

func NewMiseSource

func NewMiseSource(dir string) CommandSource

func NewNpmSource

func NewNpmSource(dir string) CommandSource

func NewPnpmSource

func NewPnpmSource(dir string) CommandSource

func NewPoetrySource

func NewPoetrySource(dir string) CommandSource

func NewUvSource

func NewUvSource(dir string) CommandSource

func NewYarnSource

func NewYarnSource(dir string) CommandSource

type DenoSource

type DenoSource struct {
	// contains filtered or unexported fields
}

DenoSource for Deno projects

func (*DenoSource) FindCommand

func (d *DenoSource) FindCommand(command string, args []string) *exec.Cmd

func (*DenoSource) ListCommands

func (d *DenoSource) ListCommands() map[string]CommandInfo

func (*DenoSource) Name

func (b *DenoSource) Name() string

func (*DenoSource) Priority

func (b *DenoSource) Priority() int

type GoSource

type GoSource struct {
	// contains filtered or unexported fields
}

GoSource for Go projects

func (*GoSource) FindCommand

func (g *GoSource) FindCommand(command string, args []string) *exec.Cmd

func (*GoSource) ListCommands

func (g *GoSource) ListCommands() map[string]CommandInfo

func (*GoSource) Name

func (b *GoSource) Name() string

func (*GoSource) Priority

func (b *GoSource) Priority() int

type GradleSource

type GradleSource struct {
	// contains filtered or unexported fields
}

GradleSource for Gradle projects

func (*GradleSource) FindCommand

func (g *GradleSource) FindCommand(command string, args []string) *exec.Cmd

func (*GradleSource) ListCommands

func (g *GradleSource) ListCommands() map[string]CommandInfo

func (*GradleSource) Name

func (b *GradleSource) Name() string

func (*GradleSource) Priority

func (b *GradleSource) Priority() int

type InteractiveSession

type InteractiveSession struct {
	// contains filtered or unexported fields
}

InteractiveSession manages the interactive mode state

type JustSource

type JustSource struct {
	// contains filtered or unexported fields
}

JustSource represents commands from justfile

func (*JustSource) FindCommand

func (j *JustSource) FindCommand(command string, args []string) *exec.Cmd

func (*JustSource) ListCommands

func (j *JustSource) ListCommands() map[string]CommandInfo

func (*JustSource) Name

func (b *JustSource) Name() string

func (*JustSource) Priority

func (b *JustSource) Priority() int

type MakeSource

type MakeSource struct {
	// contains filtered or unexported fields
}

MakeSource represents commands from Makefile

func (*MakeSource) FindCommand

func (m *MakeSource) FindCommand(command string, args []string) *exec.Cmd

func (*MakeSource) ListCommands

func (m *MakeSource) ListCommands() map[string]CommandInfo

func (*MakeSource) Name

func (b *MakeSource) Name() string

func (*MakeSource) Priority

func (b *MakeSource) Priority() int

type MavenSource

type MavenSource struct {
	// contains filtered or unexported fields
}

MavenSource for Maven projects

func (*MavenSource) FindCommand

func (m *MavenSource) FindCommand(command string, args []string) *exec.Cmd

func (*MavenSource) ListCommands

func (m *MavenSource) ListCommands() map[string]CommandInfo

func (*MavenSource) Name

func (b *MavenSource) Name() string

func (*MavenSource) Priority

func (b *MavenSource) Priority() int

type MiseSource

type MiseSource struct {
	// contains filtered or unexported fields
}

MiseSource represents commands from .mise.toml

func (*MiseSource) FindCommand

func (m *MiseSource) FindCommand(command string, args []string) *exec.Cmd

func (*MiseSource) ListCommands

func (m *MiseSource) ListCommands() map[string]CommandInfo

func (*MiseSource) Name

func (b *MiseSource) Name() string

func (*MiseSource) Priority

func (b *MiseSource) Priority() int

type NpmSource

type NpmSource struct {
	// contains filtered or unexported fields
}

NpmSource for npm projects

func (*NpmSource) FindCommand

func (n *NpmSource) FindCommand(command string, args []string) *exec.Cmd

func (*NpmSource) ListCommands

func (n *NpmSource) ListCommands() map[string]CommandInfo

type PnpmSource

type PnpmSource struct {
	// contains filtered or unexported fields
}

PnpmSource for pnpm projects

func (*PnpmSource) FindCommand

func (n *PnpmSource) FindCommand(command string, args []string) *exec.Cmd

func (*PnpmSource) ListCommands

func (n *PnpmSource) ListCommands() map[string]CommandInfo

type PoetrySource

type PoetrySource struct {
	// contains filtered or unexported fields
}

PoetrySource for Poetry projects

func (*PoetrySource) FindCommand

func (p *PoetrySource) FindCommand(command string, args []string) *exec.Cmd

func (*PoetrySource) ListCommands

func (p *PoetrySource) ListCommands() map[string]CommandInfo

func (*PoetrySource) Name

func (b *PoetrySource) Name() string

func (*PoetrySource) Priority

func (b *PoetrySource) Priority() int

type Project

type Project struct {
	Dir            string
	CommandSources []CommandSource
}

Project represents a directory with multiple command sources

func ResolveProject

func ResolveProject(dir string) *Project

ResolveProject analyzes a directory and returns a Project with all applicable CommandSources

type TerminalManager

type TerminalManager struct {
	// contains filtered or unexported fields
}

TerminalManager handles terminal mode switching and input

func NewTerminalManager

func NewTerminalManager() *TerminalManager

NewTerminalManager creates a new terminal manager

func (*TerminalManager) ReadKey

func (tm *TerminalManager) ReadKey() (rune, error)

ReadKey reads a single key from the terminal

func (*TerminalManager) RestoreMode

func (tm *TerminalManager) RestoreMode() error

RestoreMode restores the terminal to its original mode

func (*TerminalManager) SetRawMode

func (tm *TerminalManager) SetRawMode() error

SetRawMode puts the terminal in raw mode for single-key input

func (*TerminalManager) SetupSignalHandling

func (tm *TerminalManager) SetupSignalHandling(cleanup func())

SetupSignalHandling sets up signal handlers for clean exit

type UvSource

type UvSource struct {
	// contains filtered or unexported fields
}

UvSource for uv projects

func (*UvSource) FindCommand

func (u *UvSource) FindCommand(command string, args []string) *exec.Cmd

func (*UvSource) ListCommands

func (u *UvSource) ListCommands() map[string]CommandInfo

func (*UvSource) Name

func (b *UvSource) Name() string

func (*UvSource) Priority

func (b *UvSource) Priority() int

type YarnSource

type YarnSource struct {
	// contains filtered or unexported fields
}

YarnSource for yarn projects

func (*YarnSource) FindCommand

func (n *YarnSource) FindCommand(command string, args []string) *exec.Cmd

func (*YarnSource) ListCommands

func (n *YarnSource) ListCommands() map[string]CommandInfo

Jump to

Keyboard shortcuts

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