format

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultWorktreeFormat = "{repo}-{branch}"

DefaultWorktreeFormat is the default format for worktree folder names

Variables

View Source
var ValidPlaceholders = []string{"{repo}", "{branch}", "{folder}"}

ValidPlaceholders lists all supported placeholders

Functions

func FormatWorktreeName

func FormatWorktreeName(format string, params FormatParams) string

FormatWorktreeName applies the format template to generate a worktree folder name

func SanitizeForPath

func SanitizeForPath(name string) string

SanitizeForPath replaces characters that are problematic in file paths Replaces: / \ : * ? " < > | with -

func ValidateFormat

func ValidateFormat(format string) error

ValidateFormat checks if a format string is valid Returns error if format contains unknown placeholders

Types

type FormatParams

type FormatParams struct {
	GitOrigin  string // repo name from git remote get-url origin
	BranchName string // branch name as provided
	FolderName string // actual folder name of git repo on disk
}

FormatParams contains the values for placeholder substitution

Jump to

Keyboard shortcuts

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