Documentation
¶
Index ¶
- Variables
- func ConfirmPromptBox(message string)
- func IsMultilineMarker(input string) bool
- func ShowColoredDiff(oldStr, newStr string, opts *DiffOptions)
- func ShowUnifiedDiff(diffOutput string)
- func SimpleDivider(width int)
- func ToolConfirmBox(toolName string, details []string)
- func TrimBracketedPasteMarkers(input string) string
- type BoxStyle
- type DiffOptions
- type MultilineReader
- type Pager
- type PasteMode
- type Spinner
Constants ¶
This section is empty.
Variables ¶
var ( // 基本色 Cyan = color.New(color.FgCyan) // 情報・ヘッダー Yellow = color.New(color.FgYellow) // 警告・プロンプト Green = color.New(color.FgGreen) // 成功・追加 Red = color.New(color.FgRed) // エラー・削除 White = color.New(color.FgWhite) // 通常テキスト Blue = color.New(color.FgBlue) // リンク・参照 Magenta = color.New(color.FgMagenta) // 特殊・ハイライト // Bold variants BoldCyan = color.New(color.FgCyan, color.Bold) BoldYellow = color.New(color.FgYellow, color.Bold) BoldGreen = color.New(color.FgGreen, color.Bold) BoldRed = color.New(color.FgRed, color.Bold) BoldWhite = color.New(color.FgWhite, color.Bold) // 特殊用途 Dim = color.New(color.Faint) // 薄い表示(コンテキスト行など) Bold = color.New(color.Bold) // 太字 Faint = color.New(color.Faint) // 薄い表示 )
共通色定義 全パッケージで一貫した色使いを実現するための定義
var ( Info = Cyan // 情報メッセージ Success = Green // 成功メッセージ Warning = Yellow // 警告メッセージ Error = Red // エラーメッセージ Prompt = Yellow // ユーザー入力プロンプト Header = BoldCyan // セクションヘッダー )
用途別エイリアス(セマンティックカラー)
var DefaultBoxStyle = BoxStyle{
TopLeft: "┌",
TopRight: "┐",
BottomLeft: "└",
BottomRight: "┘",
Horizontal: "─",
Vertical: "│",
LeftT: "├",
RightT: "┤",
}
DefaultBoxStyle は標準のボックススタイル
var DefaultDiffOptions = DiffOptions{ ContextLines: 3, ShowLineNums: true, InlineMode: true, MaxTotalLines: 50, }
DefaultDiffOptions はデフォルトの差分表示オプション
Functions ¶
func ConfirmPromptBox ¶ added in v0.31.0
func ConfirmPromptBox(message string)
ConfirmPromptBox は確認プロンプト用のボックスを表示
func IsMultilineMarker ¶ added in v0.29.0
IsMultilineMarker checks if the input is a multiline marker
func ShowColoredDiff ¶ added in v0.31.0
func ShowColoredDiff(oldStr, newStr string, opts *DiffOptions)
ShowColoredDiff は色付きの差分を表示 oldStr: 変更前のテキスト newStr: 変更後のテキスト opts: 表示オプション(nilならデフォルト使用)
func ShowUnifiedDiff ¶ added in v0.31.0
func ShowUnifiedDiff(diffOutput string)
ShowUnifiedDiff はUnified Diff形式で色付き表示
func ToolConfirmBox ¶ added in v0.31.0
ToolConfirmBox はツール確認用のボックスを表示
func TrimBracketedPasteMarkers ¶ added in v0.29.0
TrimBracketedPasteMarkers removes bracketed paste markers from input (both forms)
Types ¶
type BoxStyle ¶ added in v0.31.0
type BoxStyle struct {
TopLeft string
TopRight string
BottomLeft string
BottomRight string
Horizontal string
Vertical string
LeftT string
RightT string
}
BoxStyle はボックスの罫線スタイル
type DiffOptions ¶ added in v0.31.0
type DiffOptions struct {
ContextLines int // 差分前後の表示行数
ShowLineNums bool // 行番号を表示するか
InlineMode bool // インラインモード(追加・削除を連続表示)
MaxTotalLines int // 最大表示行数(0=無制限)
}
DiffOptions は差分表示のオプション
type MultilineReader ¶ added in v0.29.0
type MultilineReader struct {
// contains filtered or unexported fields
}
MultilineReader handles multiline input with bracketed paste mode and ``` markers
func NewMultilineReader ¶ added in v0.29.0
func NewMultilineReader(r io.Reader) *MultilineReader
NewMultilineReader creates a new multiline reader
func (*MultilineReader) DisableBracketedPaste ¶ added in v0.29.0
func (m *MultilineReader) DisableBracketedPaste()
DisableBracketedPaste is a no-op (kept for API compatibility)
func (*MultilineReader) EnableBracketedPaste ¶ added in v0.29.0
func (m *MultilineReader) EnableBracketedPaste()
EnableBracketedPaste is a no-op (kept for API compatibility) Note: We don't enable bracketed paste mode because some terminals (WSL/Ubuntu) display the escape sequences as literal text. Instead, we just strip markers.
func (*MultilineReader) FlushInput ¶ added in v0.31.0
func (m *MultilineReader) FlushInput()
FlushInput discards any buffered input data This should be called after AI output completes to ignore keypresses during output
type PasteMode ¶ added in v0.31.0
type PasteMode struct {
// contains filtered or unexported fields
}
PasteMode captures multiline input for environments where bracketed paste mode is unreliable. It is also reusable from other input contexts (e.g., comment input during confirmations).
End conditions: - empty line x2 - "END" or "/end" - Ctrl+D (EOF)
Cancel: - "/cancel" or "/c" (content is discarded)
Limits: - max lines / max bytes - idle timeout
Note: This does NOT read from the OS clipboard. It is an interactive capture mode.
func NewPasteMode ¶ added in v0.31.0
func NewPasteMode(cfg config.PasteConfig) *PasteMode
func (*PasteMode) Capture ¶ added in v0.31.0
func (p *PasteMode) Capture(in io.Reader, out io.Writer) (content string, cancelled bool, err error)
Capture reads multiline input from in and writes prompts/help to out. Returns captured content, cancelled=true when user cancelled, and error when I/O fails.
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner はターミナルでアニメーションを表示
func NewSpinnerWithWriter ¶ added in v0.31.0
NewSpinnerWithWriter は出力先を指定してSpinnerを作成 run_test などで stdout 出力(コマンド結果)と混ざらないよう、stderr を指定する用途を想定。