shell

package
v0.0.62 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const HelpersFileContent = `` /* 208-byte string literal not displayed */

HelpersFileContent is the template content for the helpers.sh file

Variables

This section is empty.

Functions

func AddFeatureToShell

func AddFeatureToShell(repoPath, shellName, featureName string, strategy string, onCommand []string, disabled bool, options map[string]any) error

AddFeatureToShell adds a feature to a specific shell

func CleanupShellDirectory

func CleanupShellDirectory(repoPath, shellName string) error

CleanupShellDirectory removes a shell directory and its contents

func DetectCurrentShell

func DetectCurrentShell() (string, error)

DetectCurrentShell attempts to detect the current shell

func DisableFeature

func DisableFeature(repoPath, shellName, featureName string) error

DisableFeature disables a feature

func EnableFeature

func EnableFeature(repoPath, shellName, featureName string) error

EnableFeature enables a disabled feature

func EnableFeatureWithOptions added in v0.0.30

func EnableFeatureWithOptions(repoPath, shellName, featureName, strategy string, onCommand []string) error

EnableFeatureWithOptions enables a disabled feature and optionally updates its configuration

func GenerateInitScript

func GenerateInitScript(repoPath, shellName string) (string, error)

GenerateInitScript generates a complete init script for a shell Supports eager, defer, and on-command loading strategies (Phase 5) Supports local overrides via enabled.local.json (Phase 6)

func GetFeatureFilePath

func GetFeatureFilePath(repoPath, shellName, featureName string) (string, error)

GetFeatureFilePath returns the path to a specific feature file

func GetFeaturesDirectory

func GetFeaturesDirectory(repoPath, shellName string) string

GetFeaturesDirectory returns the path to the features directory for a shell

func GetInitScriptPath

func GetInitScriptPath(repoPath, shellName string) (string, error)

GetInitScriptPath returns the path to the init script for a shell

func GetLocalManifestPath

func GetLocalManifestPath(repoPath, shellName string) string

GetLocalManifestPath returns the path to enabled.local.json for a shell

func GetManifestPath

func GetManifestPath(repoPath, shellName string) string

GetManifestPath returns the path to enabled.json for a shell

func GetShellDirectory

func GetShellDirectory(repoPath, shellName string) string

GetShellDirectory returns the path to the shell directory within omd-shells

func InitializeShellDirectory

func InitializeShellDirectory(repoPath, shellName string) error

InitializeShellDirectory creates the directory structure for a shell

func IsShellExecutableAvailable added in v0.0.47

func IsShellExecutableAvailable(shellName string) bool

IsShellExecutableAvailable reports whether the current environment can resolve a shell executable.

func IsShellSupported

func IsShellSupported(shellName string) bool

IsShellSupported checks if a shell is supported

func ListShellsWithFeatures

func ListShellsWithFeatures(repoPath string) ([]string, error)

ListShellsWithFeatures returns a list of shells that have been initialized

func LocalManifestFileName added in v0.0.41

func LocalManifestFileName() string

LocalManifestFileName returns the filename used for device-local shell overrides.

func NeedsCleanup

func NeedsCleanup(repoPath, shellName string) (bool, error)

NeedsCleanup checks if a shell directory should be cleaned up (no features left)

func RefreshFeatureTemplate added in v0.0.53

func RefreshFeatureTemplate(repoPath, shellName, featureName string) error

RefreshFeatureTemplate rewrites an installed feature file from the catalog template.

func RegenerateAllInitScripts

func RegenerateAllInitScripts(repoPath string) error

TODO: Hook up somehow so the user can use it RegenerateAllInitScripts regenerates init scripts for all initialized shells

func RegenerateInitScript

func RegenerateInitScript(repoPath, shellName string) error

RegenerateInitScript regenerates the init script for a shell This should be called after any manifest changes

func RemoveFeatureFromShell

func RemoveFeatureFromShell(repoPath, shellName, featureName string) error

RemoveFeatureFromShell removes a feature from a shell

func ResolveProfilePath

func ResolveProfilePath(shellConfig ShellConfig) (string, error)

ResolveProfilePath resolves the profile path for a shell, expanding ~ to home directory

func ShellDirectoryExists

func ShellDirectoryExists(repoPath, shellName string) bool

ShellDirectoryExists checks if a shell directory has been initialized

func SupportedShells

func SupportedShells() map[string]ShellConfig

SupportedShells returns a map of all supported shells with their configurations

Types

type FeaturesByStrategy

type FeaturesByStrategy struct {
	Eager     []string
	Defer     []string
	OnCommand map[string][]string // feature name -> trigger commands
}

FeaturesByStrategy organizes features by their loading strategy

type ShellConfig

type ShellConfig struct {
	Name        string // Shell name (e.g., "bash", "zsh", "fish", "powershell", "posix")
	ProfilePath string // Path to the shell's profile file (e.g., "~/.bashrc")
	Extension   string // File extension for feature files (e.g., ".sh", ".zsh", ".fish")
	InitScript  string // Name of the init script (e.g., "init.sh", "init.zsh")
}

ShellConfig represents the configuration for a specific shell

func GetShellConfig

func GetShellConfig(shellName string) (ShellConfig, bool)

GetShellConfig returns the configuration for a specific shell

Jump to

Keyboard shortcuts

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