remove append#

This commit is contained in:
2026-08-27 19:07:53 +01:00
parent adc276c28a
commit 8bfd6b22c5
3 changed files with 38 additions and 72 deletions
+14 -14
View File
@@ -2,6 +2,8 @@ package tui
import (
"fmt"
"os"
"path/filepath"
"strings"
"charm.land/bubbles/v2/textarea"
@@ -15,7 +17,6 @@ import (
const (
fieldInputDir = iota
fieldOutputDir
fieldAppend
fieldForce
fieldVerticalSlices
fieldSkipFrontend
@@ -40,7 +41,6 @@ type FormModel struct {
maxDepth textinput.Model
maxSize textinput.Model
ignoreArea textarea.Model
appendMode Checkbox
force Checkbox
verticalSlices Checkbox
skipFrontend Checkbox
@@ -54,15 +54,25 @@ type FormModel struct {
err string
}
func defaultOutputDir() string {
cwd, err := os.Getwd()
if err != nil {
return "/tmp/output_dirmd"
}
base := filepath.Base(cwd)
return filepath.Join("/tmp", base+"_dirmd")
}
func NewForm() FormModel {
inputDir := textinput.New()
inputDir.Placeholder = "."
inputDir.SetValue(".")
inputDir.SetWidth(60)
defOut := defaultOutputDir()
outputDir := textinput.New()
outputDir.Placeholder = "./output_dirmd"
outputDir.SetValue("./output_dirmd")
outputDir.Placeholder = defOut
outputDir.SetValue(defOut)
outputDir.SetWidth(60)
drivePath := textinput.New()
@@ -90,7 +100,6 @@ func NewForm() FormModel {
maxDepth: maxDepth,
maxSize: maxSize,
ignoreArea: ignoreArea,
appendMode: Checkbox{Label: "Append to existing file"},
force: Checkbox{Label: "Force overwrite"},
verticalSlices: Checkbox{Label: "Vertical slices"},
skipFrontend: Checkbox{Label: "Skip frontend files"},
@@ -238,8 +247,6 @@ func (m FormModel) Update(msg tea.Msg) (FormModel, tea.Cmd) {
return m, tea.Batch(cmds...)
case isActivate(k):
switch m.focusIndex {
case fieldAppend:
m.appendMode.Toggle()
case fieldForce:
m.force.Toggle()
case fieldVerticalSlices:
@@ -317,8 +324,6 @@ func (m FormModel) View() string {
b.WriteString(m.renderTextField("Output directory", m.outputDir, m.focusIndex == fieldOutputDir))
b.WriteString("\n\n")
b.WriteString(m.appendMode.Render(m.focusIndex == fieldAppend))
b.WriteString("\n")
b.WriteString(m.force.Render(m.focusIndex == fieldForce))
b.WriteString("\n")
b.WriteString(m.verticalSlices.Render(m.focusIndex == fieldVerticalSlices))
@@ -428,10 +433,6 @@ func (m FormModel) ToConfig() (*config.Config, error) {
return nil, fmt.Errorf("--skip-frontend and --frontend-only are mutually exclusive")
}
if m.appendMode.Checked && m.verticalSlices.Checked {
return nil, fmt.Errorf("--append and --vertical-slices are mutually exclusive")
}
excludedExts := append([]string{}, config.DefaultExts...)
if m.skipFrontend.Checked {
excludedExts = append(excludedExts, config.FrontendExts...)
@@ -443,7 +444,6 @@ func (m FormModel) ToConfig() (*config.Config, error) {
cfg := &config.Config{
InputPath: inputDir,
OutputPath: outputDir,
AppendMode: m.appendMode.Checked,
Force: m.force.Checked,
MaxSize: int64(maxSizeKB) * 1024,
MaxDepth: maxDepth,