Documentation
¶
Index ¶
- Variables
- func GetFeatureTemplate(featureName, shellName string) (string, error)
- func GetShellExtension(shellName string) string
- func HasFeatureTemplate(featureName, shellName string) bool
- func RenderFeatureTemplate(content, featureName, shellName string, optionValues map[string]any) (string, error)
- func WriteFeatureTemplate(repoPath, shellName, featureName string, optionValues map[string]any) error
- type FeatureMetadata
- type OptionMetadata
- type OptionType
Constants ¶
This section is empty.
Variables ¶
var Catalog = map[string]FeatureMetadata{ "core-aliases": { Name: "core-aliases", Description: "Essential command aliases (ls, cd, git shortcuts)", Category: "alias", DefaultStrategy: "eager", DefaultCommands: nil, SupportedShells: []string{"bash", "zsh", "fish", "posix"}, }, "git-prompt": { Name: "git-prompt", Description: "Git branch and status in shell prompt", Category: "prompt", DefaultStrategy: "eager", DefaultCommands: nil, SupportedShells: []string{"bash", "zsh", "fish"}, }, "kubectl-completion": { Name: "kubectl-completion", Description: "Kubernetes CLI command completion", Category: "completion", DefaultStrategy: "on-command", DefaultCommands: []string{"kubectl"}, SupportedShells: []string{"bash", "zsh", "fish"}, }, "docker-completion": { Name: "docker-completion", Description: "Docker CLI command completion", Category: "completion", DefaultStrategy: "on-command", DefaultCommands: []string{"docker"}, SupportedShells: []string{"bash", "zsh", "fish"}, }, "nvm": { Name: "nvm", Description: "Node Version Manager integration", Category: "tool", DefaultStrategy: "on-command", DefaultCommands: []string{"nvm", "node", "npm"}, SupportedShells: []string{"bash", "zsh", "fish"}, }, "terraform-completion": { Name: "terraform-completion", Description: "Terraform CLI command completion", Category: "completion", DefaultStrategy: "on-command", DefaultCommands: []string{"terraform", "tf"}, SupportedShells: []string{"bash", "zsh", "fish"}, }, "aws-completion": { Name: "aws-completion", Description: "AWS CLI command completion", Category: "completion", DefaultStrategy: "on-command", DefaultCommands: []string{"aws"}, SupportedShells: []string{"bash", "zsh", "fish"}, }, "gcloud-completion": { Name: "gcloud-completion", Description: "Google Cloud CLI command completion", Category: "completion", DefaultStrategy: "on-command", DefaultCommands: []string{"gcloud"}, SupportedShells: []string{"bash", "zsh", "fish"}, }, "python-venv": { Name: "python-venv", Description: "Python virtual environment helpers", Category: "tool", DefaultStrategy: "eager", DefaultCommands: nil, SupportedShells: []string{"bash", "zsh", "fish"}, }, "directory-shortcuts": { Name: "directory-shortcuts", Description: "Quick navigation to common directories", Category: "alias", DefaultStrategy: "eager", DefaultCommands: nil, SupportedShells: []string{"bash", "zsh", "fish", "posix"}, }, "ssh-agent": { Name: "ssh-agent", Description: "Automatically start SSH agent and load keys", Category: "tool", DefaultStrategy: "eager", DefaultCommands: nil, SupportedShells: []string{"bash", "zsh", "fish", "posix"}, }, "oh-my-dot-completion": { Name: "oh-my-dot-completion", Description: "Shell completions for oh-my-dot commands", Category: "completion", DefaultStrategy: "eager", DefaultCommands: nil, SupportedShells: []string{"bash", "zsh", "fish", "powershell"}, }, "homebrew-path": { Name: "homebrew-path", Description: "Sets up Homebrew PATH on Linux for package management", Category: "environment", DefaultStrategy: "eager", DefaultCommands: nil, SupportedShells: []string{"bash", "zsh", "fish", "posix"}, }, "powershell-prompt": { Name: "powershell-prompt", Description: "Custom PowerShell prompt with git status", Category: "prompt", DefaultStrategy: "eager", DefaultCommands: nil, SupportedShells: []string{"powershell"}, }, "powershell-aliases": { Name: "powershell-aliases", Description: "Common PowerShell aliases and Unix-like helpers", Category: "alias", DefaultStrategy: "eager", DefaultCommands: nil, SupportedShells: []string{"powershell"}, }, "powershell-psreadline": { Name: "powershell-psreadline", Description: "PSReadLine key bindings and interactive editing enhancements", Category: "tool", DefaultStrategy: "eager", DefaultCommands: nil, SupportedShells: []string{"powershell"}, }, "posh-git": { Name: "posh-git", Description: "Git prompt and tab completion for PowerShell", Category: "tool", DefaultStrategy: "eager", DefaultCommands: nil, SupportedShells: []string{"powershell"}, }, "terminal-icons": { Name: "terminal-icons", Description: "File and folder icons for PowerShell directory listings", Category: "tool", DefaultStrategy: "eager", DefaultCommands: nil, SupportedShells: []string{"powershell"}, }, "dotnet-completion": { Name: "dotnet-completion", Description: "Native PowerShell argument completion for the dotnet CLI", Category: "completion", DefaultStrategy: "eager", DefaultCommands: nil, SupportedShells: []string{"powershell"}, }, "winget-completion": { Name: "winget-completion", Description: "Native PowerShell argument completion for the winget CLI", Category: "completion", DefaultStrategy: "eager", DefaultCommands: nil, SupportedShells: []string{"powershell"}, }, "winget-command-not-found": { Name: "winget-command-not-found", Description: "WinGet command-not-found suggestions for PowerShell", Category: "tool", DefaultStrategy: "eager", DefaultCommands: nil, SupportedShells: []string{"powershell"}, }, "oh-my-posh": { Name: "oh-my-posh", Description: "Oh My Posh prompt engine with customizable themes", Category: "prompt", DefaultStrategy: "eager", DefaultCommands: nil, SupportedShells: []string{"bash", "zsh", "fish", "powershell"}, Options: []OptionMetadata{ { Name: "theme", DisplayName: "Theme", Description: "Oh My Posh theme to use", Type: OptionTypeEnum, Required: true, EnumValues: []string{ "1_shell", "agnoster", "amro", "atomic", "atomicBit", "dracula", "jandedobbeleer", "paradox", "powerlevel10k_rainbow", "pure", "robbyrussell", }, }, { Name: "config_file", DisplayName: "Config File", Description: "Path to custom Oh My Posh configuration file (optional)", Type: OptionTypeFile, Required: false, PathMustExist: true, FileOnly: true, }, { Name: "auto_upgrade", DisplayName: "Auto Upgrade", Description: "Automatically check for updates on shell start", Type: OptionTypeBool, Required: false, Default: false, }, }, }, }
Catalog is the global feature catalog
Functions ¶
func GetFeatureTemplate ¶ added in v0.0.29
GetFeatureTemplate retrieves the template content for a feature and shell Falls back to posix.sh for POSIX-compatible shells if shell-specific template doesn't exist
func GetShellExtension ¶ added in v0.0.29
GetShellExtension returns the file extension for a given shell
func HasFeatureTemplate ¶ added in v0.0.29
HasFeatureTemplate checks if a template exists for a feature and shell Returns true if either shell-specific or posix fallback exists
Types ¶
type FeatureMetadata ¶
type FeatureMetadata struct {
Name string // Feature identifier (e.g., "git-prompt")
Description string // Human-readable description
Category string // Category (e.g., "prompt", "completion", "alias")
DefaultStrategy string // Default load strategy ("eager", "defer", "on-command")
DefaultCommands []string // Default trigger commands for on-command features
SupportedShells []string // Shells that support this feature
Options []OptionMetadata // Configurable options for this feature
}
FeatureMetadata contains metadata about a feature from the catalog
func GetFeature ¶
func GetFeature(name string) (FeatureMetadata, bool)
GetFeature retrieves feature metadata from the catalog
func ListFeatures ¶
func ListFeatures() []FeatureMetadata
ListFeatures returns all features in the catalog
func ListFeaturesByCategory ¶
func ListFeaturesByCategory(category string) []FeatureMetadata
ListFeaturesByCategory returns features in a specific category
func ListFeaturesForShell ¶
func ListFeaturesForShell(shell string) []FeatureMetadata
ListFeaturesForShell returns features that support a specific shell
func (*FeatureMetadata) SupportsShell ¶
func (f *FeatureMetadata) SupportsShell(shell string) bool
SupportsShell checks if a feature supports a specific shell
type OptionMetadata ¶ added in v0.0.38
type OptionMetadata struct {
Name string // Internal identifier (e.g., "theme_name")
DisplayName string // Human-readable label (e.g., "Theme Name")
Description string // Help text for the user
Type OptionType // Data type
Required bool // Whether this option is mandatory
Default any // Default value (used if user skips optional field)
// Type-specific constraints
EnumValues []string // Valid values for enum type
IntMin *int // Minimum value for int type
IntMax *int // Maximum value for int type
PathMustExist bool // For file/path: must the path already exist?
FileOnly bool // For path: restrict to files only (no directories)
// Validation
Validator func(any) error // Custom validation function
}
OptionMetadata defines a configurable option for a feature
type OptionType ¶ added in v0.0.38
type OptionType string
OptionType represents the type of a feature option
const ( OptionTypeString OptionType = "string" OptionTypeInt OptionType = "int" OptionTypeBool OptionType = "bool" OptionTypeEnum OptionType = "enum" OptionTypeFile OptionType = "file" OptionTypePath OptionType = "path" )