Skip to content

adapters/shell

import "go-cli-template/internal/adapters/shell"

Index

func DetectShell

func DetectShell() string

DetectShell attempts to detect the current shell from environment variables. Returns the detected shell type or “bash” as a fallback.

func GetFileExtension

func GetFileExtension(shellType string) string

GetFileExtension returns the appropriate file extension for the shell.

type Adapter

Adapter handles shell-specific syntax for aliases and functions.

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

func New

func New(shellType string) *Adapter

New creates a new shell adapter for the given shell type.

func (*Adapter) FormatAlias

func (a *Adapter) FormatAlias(alias, command string) string

FormatAlias formats a bookmark alias for the configured shell.

Source

See internal/adapters/shell/ for implementation details.