Documentation
¶
Index ¶
- func HookUpdateMessage(configDir, rcFile, currentVersion string, credHelperInstalled ...bool) string
- func Install(sh Shell, fw Framework, alias string) (string, error)
- func InstallGHWrapper(sh Shell) (string, error)
- func InstalledHookIsCurrent(rcFile string) bool
- func IsGHWrapperInstalled(path string) bool
- func IsInstalled(path string) bool
- func RCFile(sh Shell) string
- func Reinstall(sh Shell, fw Framework, alias string) (string, error)
- func Uninstall(sh Shell) (string, error)
- func UninstallGHWrapper(sh Shell) (string, error)
- func WriteHookVersion(configDir, version string) error
- type Framework
- type Shell
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HookUpdateMessage ¶
func HookUpdateMessage(configDir, rcFile, currentVersion string, credHelperInstalled ...bool) string
HookUpdateMessage returns a one-line hint shown in the terminal on shell open when gitswitch needs attention. Returns "" when everything is current.
Checks (in priority order):
- No version file + shell marker present → old install, nudge to reinstall
- Shell hook content changed + something else needed → combined message
- Shell hook content changed only → plain "shell updated" message
- HTTPS and/or Session Isolation needed, hook otherwise current → targeted nudge
credHelperInstalled should be the result of git.IsCredentialHelperInstalled(). Passing it as a variadic bool avoids an import cycle (shell ← git). Dev/empty versions are ignored so local builds don't corrupt the version file.
func Install ¶
Install writes the appropriate integration for the detected framework. alias is the short command alias to add (e.g. "gs"); pass "" to skip the alias line. Returns a human-readable description of what was done.
func InstallGHWrapper ¶ added in v0.3.0
InstallGHWrapper writes the `gh` wrapper function to sh's rc file. It is independent of the main shell-integration block (marker) so it can be toggled without touching the nudge/prompt/completion setup.
func InstalledHookIsCurrent ¶
InstalledHookIsCurrent returns true when the installed hook already contains "gitswitch hook-check", the fingerprint added alongside hook-version tracking. Its presence means the hook is already the current format and no reinstall is needed.
func IsGHWrapperInstalled ¶ added in v0.3.0
IsGHWrapperInstalled checks whether the gh wrapper block exists in path.
func IsInstalled ¶
IsInstalled checks whether the gitswitch marker exists in the given file.
func Reinstall ¶
Reinstall removes the existing integration block and writes a fresh one. Use this to apply alias changes without requiring a manual uninstall/install cycle.
func Uninstall ¶
Uninstall removes the gitswitch marker block from the rc file for the provided shell, removes it from starship.toml if present, and removes the OMZ plugin file if present. Returns a human-readable description of what was removed.
func UninstallGHWrapper ¶ added in v0.3.0
UninstallGHWrapper removes the `gh` wrapper block from sh's rc file.
func WriteHookVersion ¶
WriteHookVersion persists the installed hook version+revision to configDir/hook-version, as "version|revision". Skips writing when version is "dev" so local/test builds don't corrupt the version file and cause spurious "dev → vX.Y.Z" nudges for real installs.