internal

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExecCommand = exec.Command

ExecCommand is used to run external commands. It can be replaced in tests.

Functions

func ChangeFileContent added in v0.1.0

func ChangeFileContent(cwd string, processorFn FileProcessor) (bool, error)

ChangeFileContent walks through cwd and applies the processorFn to every Go file found. Files in a vendor directory are skipped. It returns true if any file content was modified.

func RunGoMod added in v0.4.0

func RunGoMod(root string) error

RunGoMod executes `go mod tidy`, `go mod download` and `go mod vendor` inside every directory under root that contains a go.mod file referencing github.com/gofiber/fiber. Directories named `vendor` are skipped.

func SetFileFilters added in v0.6.0

func SetFileFilters(include, exclude []string)

SetFileFilters sets the include and exclude patterns used by ChangeFileContent.

Types

type FileProcessor added in v0.1.0

type FileProcessor func(content string) string

FileProcessor processes the file content and returns the modified content.

type Prompt

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

Prompt represents a small interactive input prompt used in the CLI.

func NewPrompt

func NewPrompt(title string, placeholder ...string) *Prompt

NewPrompt initializes a new Prompt with an optional placeholder value.

func (*Prompt) Answer

func (p *Prompt) Answer() (result string, err error)

Answer displays the prompt and returns the user's input.

func (*Prompt) Init

func (p *Prompt) Init() tea.Cmd

Init initializes the bubbletea program for the prompt.

func (*Prompt) Update

func (p *Prompt) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles prompt events and updates its state.

func (*Prompt) View

func (p *Prompt) View() string

View renders the prompt UI.

func (*Prompt) YesOrNo

func (p *Prompt) YesOrNo() (bool, error)

YesOrNo runs the prompt and returns true if the answer resembles "yes".

type SpinnerCmd added in v0.0.5

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

SpinnerCmd wraps an exec.Cmd and displays a spinner while it runs.

func NewSpinnerCmd added in v0.0.5

func NewSpinnerCmd(cmd *exec.Cmd, title ...string) *SpinnerCmd

NewSpinnerCmd returns a SpinnerCmd that runs the given command. The optional title is shown alongside the spinner.

func (*SpinnerCmd) Init added in v0.0.5

func (t *SpinnerCmd) Init() tea.Cmd

Init implements the tea.Model interface.

func (*SpinnerCmd) Run added in v0.0.5

func (t *SpinnerCmd) Run() (err error)

Run executes the command and manages the spinner lifecycle.

func (*SpinnerCmd) Update added in v0.0.5

func (t *SpinnerCmd) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*SpinnerCmd) UpdateOutput added in v0.0.5

func (t *SpinnerCmd) UpdateOutput(c <-chan []byte)

UpdateOutput retrieves lines from c and stores them for display.

func (*SpinnerCmd) View added in v0.0.5

func (t *SpinnerCmd) View() string

type SpinnerTask added in v0.0.5

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

SpinnerTask runs a Task while showing a spinner animation.

func NewSpinnerTask added in v0.0.5

func NewSpinnerTask(title string, task Task) *SpinnerTask

NewSpinnerTask creates a SpinnerTask with the provided title and Task.

func (*SpinnerTask) Init added in v0.0.5

func (t *SpinnerTask) Init() tea.Cmd

Init implements the tea.Model interface.

func (*SpinnerTask) Run added in v0.0.5

func (t *SpinnerTask) Run() (err error)

Run executes the task while showing a spinner.

func (*SpinnerTask) Update added in v0.0.5

func (t *SpinnerTask) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles spinner events and updates its state.

func (*SpinnerTask) View added in v0.0.5

func (t *SpinnerTask) View() string

View renders the spinner view.

type Task added in v0.0.5

type Task func() error

Task is a function executed while the spinner is displayed.

Directories

Path Synopsis
v3

Jump to

Keyboard shortcuts

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