Documentation
¶
Overview ¶
Package core provides shared helpers for config subcommands.
Package core provides shared helpers for config subcommands.
It handles profile detection, symlink management, and .ctxrc file resolution used by the config status and switch commands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyProfile ¶
CopyProfile copies a source profile file to .ctxrc.
Parameters:
- root: Git repository root directory
- srcFile: Source profile filename (e.g., ".ctxrc.dev")
Returns:
- error: Non-nil on read or write failure
func DetectProfile ¶
func DetectProfile() string
DetectProfile returns the active profile name from the parsed .ctxrc. Returns "" if .ctxrc is missing or has no profile field.
Returns:
- string: Profile name ("dev", "base", or "")
func GitRoot ¶
GitRoot returns the git repository root directory.
Returns an error if git is not installed or the current directory is not inside a git repository. Features that depend on git should degrade gracefully when this returns an error.
func SwitchTo ¶
SwitchTo copies the requested profile to .ctxrc and returns a status message.
If the requested profile is already active, returns a no-op message. If .ctxrc did not previously exist, returns a "created" message.
Parameters:
- root: Git repository root directory
- profile: Target profile name (file.ProfileDev or file.ProfileBase)
Returns:
- string: Status message for the user
- error: Non-nil if the profile file copy fails
Types ¶
This section is empty.