Documentation
¶
Index ¶
- func AbbreviatePath(path string) string
- func GetOrCreateNode(root *yaml.Node, path ...string) *yaml.Node
- func GetValue(root *yaml.Node, path ...string) string
- func GlobalConfigPath() string
- func GlobalTOMLConfigPath() string
- func HasKey(root *yaml.Node, path ...string) bool
- func SetValue(root *yaml.Node, value interface{}, path ...string) error
- type Action
- type ActionType
- type Service
- func (s *Service) Actions() []Action
- func (s *Service) AppendToFile(path string, content string) error
- func (s *Service) FileContains(path string, substr string) (bool, error)
- func (s *Service) FileExists(path string) bool
- func (s *Service) IsDryRun() bool
- func (s *Service) MkdirAll(path string, perm os.FileMode) error
- func (s *Service) ReadFile(path string) ([]byte, error)
- func (s *Service) RunGitInit(path string) error
- func (s *Service) WriteFile(path string, content []byte, perm os.FileMode) error
- type TOMLHandler
- type YAMLHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbbreviatePath ¶
AbbreviatePath replaces the home directory with ~ for display
func GetOrCreateNode ¶
GetOrCreateNode traverses the YAML tree and returns or creates a node at the given path. If any intermediate keys don't exist, they are created as mapping nodes.
func GetValue ¶
GetValue retrieves a string value from the YAML tree at the specified path. Returns empty string if not found.
func GlobalConfigPath ¶
func GlobalConfigPath() string
GlobalConfigPath returns the path to the global grove configuration file.
func GlobalTOMLConfigPath ¶ added in v0.6.2
func GlobalTOMLConfigPath() string
GlobalTOMLConfigPath returns the path to the global grove TOML configuration file.
Types ¶
type Action ¶
type Action struct {
Type ActionType
Description string
Path string
Success bool
Error error
}
Action represents a single action performed or simulated by the setup service
type ActionType ¶
type ActionType string
ActionType represents the type of action being performed
const ( ActionWriteFile ActionType = "write_file" ActionAppendFile ActionType = "append_file" ActionCreateDir ActionType = "create_dir" ActionUpdateYAML ActionType = "update_yaml" ActionCreateEcosystem ActionType = "create_ecosystem" )
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service encapsulates all file I/O and command execution logic for the setup wizard. It respects dry-run mode and maintains a log of actions for the summary screen.
func (*Service) AppendToFile ¶
AppendToFile appends content to a file, respecting dry-run mode. If the file doesn't exist, it creates it.
func (*Service) FileContains ¶
FileContains checks if a file contains the given substring
func (*Service) FileExists ¶
FileExists checks if a file exists at the given path
func (*Service) MkdirAll ¶
MkdirAll creates a directory and all parent directories, respecting dry-run mode
func (*Service) RunGitInit ¶
RunGitInit initializes a git repository in the given directory
type TOMLHandler ¶ added in v0.6.2
type TOMLHandler struct {
// contains filtered or unexported fields
}
TOMLHandler provides utilities for writing TOML configuration files.
func NewTOMLHandler ¶ added in v0.6.2
func NewTOMLHandler(service *Service) *TOMLHandler
NewTOMLHandler creates a new TOML handler
func (*TOMLHandler) SaveGlobalConfig ¶ added in v0.6.2
func (h *TOMLHandler) SaveGlobalConfig(config map[string]interface{}) error
SaveGlobalConfig saves a configuration map to the global grove configuration file. Uses grove.toml format.
type YAMLHandler ¶
type YAMLHandler struct {
// contains filtered or unexported fields
}
YAMLHandler provides utilities for reading and writing YAML files while preserving comments and structure using yaml.Node.
func NewYAMLHandler ¶
func NewYAMLHandler(service *Service) *YAMLHandler
NewYAMLHandler creates a new YAML handler
func (*YAMLHandler) LoadGlobalConfig ¶
func (h *YAMLHandler) LoadGlobalConfig() (*yaml.Node, error)
LoadGlobalConfig loads the global grove configuration file (~/.config/grove/grove.yml) into a yaml.Node tree. If the file doesn't exist, returns an empty document node.
func (*YAMLHandler) LoadYAML ¶
func (h *YAMLHandler) LoadYAML(path string) (*yaml.Node, error)
LoadYAML loads a YAML file into a yaml.Node tree. If the file doesn't exist, returns an empty document node.
func (*YAMLHandler) SaveGlobalConfig ¶
func (h *YAMLHandler) SaveGlobalConfig(root *yaml.Node) error
SaveGlobalConfig saves a yaml.Node tree back to the global grove configuration file. Respects the service's dry-run mode.