commands

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandExists

func CommandExists(name, baseDir string, filesystem fs.FileSystem) (bool, error)

CommandExists checks if a command exists.

func GetCommandInfo

func GetCommandInfo(name, baseDir string, filesystem fs.FileSystem) (*models.Command, error)

GetCommandInfo retrieves information about a specific command.

func Install

func Install(opts InstallOptions) error

Install installs a command from a Git repository

func ListCommands

func ListCommands(baseDir string, filesystem fs.FileSystem) ([]string, error)

ListCommands returns a list of all installed commands.

func ParseRepositorySpec

func ParseRepositorySpec(spec string) (repository, version string)

ParseRepositorySpec parses a repository specification (URL[@version])

func Remove

func Remove(opts RemoveOptions) error

Remove removes a command by name and cleans up associated files.

func VerifyCommandStructure

func VerifyCommandStructure(name, baseDir string, filesystem fs.FileSystem) (valid bool, status string, err error)

VerifyCommandStructure checks if a specific command has valid dual structure.

Types

type CommandDetail

type CommandDetail struct {
	*models.Command
	HasDirectory     bool
	HasMarkdownFile  bool
	StructureValid   bool
	StructureMessage string
}

CommandDetail contains detailed information about a command including structure validation.

func List

func List(opts ListOptions) ([]*CommandDetail, error)

List returns detailed information about all installed commands.

type GitClient

type GitClient interface {
	Clone(opts git.CloneOptions) error
	ValidateRemoteRepository(url string) error
	GetLatestTag(repoPath string) (string, error)
	GetCurrentCommit(repoPath string) (string, error)
}

GitClient interface for git operations

type InstallOptions

type InstallOptions struct {
	Repository string        // Git repository URL
	Version    string        // Version/tag to install (optional)
	Name       string        // Override command name (optional)
	Force      bool          // Force reinstall if already exists
	FileSystem fs.FileSystem // File system to use (defaults to OS)
}

InstallOptions represents options for installing a command

type ListOptions

type ListOptions struct {
	BaseDir    string
	FileSystem fs.FileSystem
}

ListOptions contains options for listing commands.

type RemoveOptions

type RemoveOptions struct {
	Name       string
	BaseDir    string
	FileSystem fs.FileSystem
}

RemoveOptions contains options for removing a command.

type SearchOptions

type SearchOptions struct {
	Keyword    string
	Tags       []string
	Author     string
	ShowAll    bool
	BaseDir    string
	FileSystem fs.FileSystem
}

SearchOptions contains options for searching commands.

type SearchResult

type SearchResult struct {
	Name        string
	Version     string
	Description string
	Author      string
	Tags        []string
	Source      string
}

SearchResult represents a command found in the search.

func Search(opts SearchOptions) ([]SearchResult, error)

Search searches for commands based on the provided options.

Jump to

Keyboard shortcuts

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