initcmd

package
v1.1.13 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProjectUnavailableLabel = "Project (unavailable: not inside a Git repository)"
	GlobalUnavailableLabel  = "Global (unavailable: user config directory not available)"
)

Variables

This section is empty.

Functions

func ChoosePath

func ChoosePath(in io.Reader, out io.Writer, repoPath string, repoErr error, globalPath string, globalErr error) (string, error)

func ChoosePathInteractive

func ChoosePathInteractive(in io.Reader, out io.Writer, repoPath string, repoErr error, globalPath string, globalErr error) (string, error)

func ChoosePathText

func ChoosePathText(in io.Reader, out io.Writer, repoPath string, repoErr error, globalPath string, globalErr error) (string, error)

func EnsureNoRepoNarrowConfig

func EnsureNoRepoNarrowConfig(cwd, repoPath string) error

func GlobalLabel

func GlobalLabel(path string) string

func IsTerminalFile

func IsTerminalFile(v any) bool

func NewFlagSet

func NewFlagSet() *pflag.FlagSet

func PathOptions

func PathOptions(repoPath string, repoErr error, globalPath string, globalErr error) []huh.Option[string]

func PrintUsage

func PrintUsage(out io.Writer, fs *pflag.FlagSet)

func ProjectLabel

func ProjectLabel() string

func ResolvePath

func ResolvePath(in io.Reader, out io.Writer, repoPath string, repoErr error, globalPath string, globalErr error, target Target) (string, error)

func Run

func Run(in io.Reader, out io.Writer, cwd, userConfigDir string, force bool, target Target) error

func ShouldUseInteractivePrompt

func ShouldUseInteractivePrompt(in io.Reader, out io.Writer) bool

Types

type Command

type Command struct {
	In            io.Reader
	Out           io.Writer
	ErrOut        io.Writer
	UsageOut      io.Writer
	Getwd         func() (string, error)
	UserConfigDir func() (string, error)
	// contains filtered or unexported fields
}

func (Command) Execute

func (c Command) Execute(args []string) int

type Flags

type Flags struct {
	Force  bool
	Repo   bool
	Global bool
	Help   bool
}

func ParseFlags

func ParseFlags(fs *pflag.FlagSet, args []string) (Flags, error)

type Target

type Target int
const (
	TargetPrompt Target = iota
	TargetRepo
	TargetGlobal
)

func TargetFromFlags

func TargetFromFlags(repoFlag, globalFlag bool) (Target, error)

Jump to

Keyboard shortcuts

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