shell

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBinaryPath

func GetBinaryPath() (string, error)

GetBinaryPath returns the path to the termonaut binary

func GetCurrentWorkingDir

func GetCurrentWorkingDir() string

GetCurrentWorkingDir returns the current working directory

func GetTerminalPID

func GetTerminalPID() int

GetTerminalPID returns the current terminal process ID

func ValidateShellInstallation

func ValidateShellInstallation() error

ValidateShellInstallation checks if the shell integration is working

Types

type ConfigBackup added in v0.9.4

type ConfigBackup struct {
	OriginalPath string
	BackupPath   string
	Timestamp    time.Time
}

ConfigBackup represents a backup of the configuration file

func (*ConfigBackup) CleanupBackup added in v0.9.4

func (backup *ConfigBackup) CleanupBackup() error

CleanupBackup removes the backup file

func (*ConfigBackup) RestoreFromBackup added in v0.9.4

func (backup *ConfigBackup) RestoreFromBackup() error

RestoreFromBackup restores the configuration file from backup

type HookInstaller

type HookInstaller struct {
	// contains filtered or unexported fields
}

HookInstaller handles shell hook installation

func NewHookInstaller

func NewHookInstaller(binaryPath string) (*HookInstaller, error)

NewHookInstaller creates a new hook installer

func (*HookInstaller) GetShellType

func (h *HookInstaller) GetShellType() ShellType

GetShellType returns the detected shell type

func (*HookInstaller) Install

func (h *HookInstaller) Install() error

Install installs the shell hook

func (*HookInstaller) InstallWithForce

func (h *HookInstaller) InstallWithForce(force bool) error

InstallWithForce installs the shell hook with force option

func (*HookInstaller) IsInstalled

func (h *HookInstaller) IsInstalled() (bool, error)

IsInstalled checks if the hook is already installed

func (*HookInstaller) Uninstall

func (h *HookInstaller) Uninstall() error

Uninstall removes the shell hook

type SafeConfigManager added in v0.9.4

type SafeConfigManager struct {
	// contains filtered or unexported fields
}

SafeConfigManager handles safe modification of shell configuration files

func NewSafeConfigManager added in v0.9.4

func NewSafeConfigManager(configFile string, shellType ShellType) *SafeConfigManager

NewSafeConfigManager creates a new safe configuration manager

func (*SafeConfigManager) AddTermonautBlock added in v0.9.4

func (scm *SafeConfigManager) AddTermonautBlock(content string) error

AddTermonautBlock safely adds the Termonaut configuration block

func (*SafeConfigManager) CreateBackup added in v0.9.4

func (scm *SafeConfigManager) CreateBackup() (*ConfigBackup, error)

CreateBackup creates a timestamped backup of the configuration file

func (*SafeConfigManager) GetTermonautBlock added in v0.9.4

func (scm *SafeConfigManager) GetTermonautBlock() ([]string, int, int, error)

GetTermonautBlock extracts the Termonaut configuration block from the file

func (*SafeConfigManager) RemoveTermonautBlock added in v0.9.4

func (scm *SafeConfigManager) RemoveTermonautBlock() error

RemoveTermonautBlock safely removes the Termonaut configuration block

type ShellType

type ShellType string

ShellType represents different shell types

const (
	// Zsh shell
	Zsh ShellType = "zsh"
	// Bash shell
	Bash ShellType = "bash"
	// Fish shell
	Fish ShellType = "fish"
	// PowerShell
	PowerShell ShellType = "powershell"
)

Jump to

Keyboard shortcuts

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