Skip to content

Commit 2e43cf9

Browse files
committed
fix(cmd): add back mistakenly removed code
The code that was inadvertently removed is now back in the codebase. #ShouldHaveHadUnitTests #TDDWouldHaveSolvedThis
1 parent 8f5a460 commit 2e43cf9

4 files changed

Lines changed: 78 additions & 2 deletions

File tree

.changes/v0.2.2.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## v0.2.2 - 2023-05-10
2+
3+
### 🐛 Bug Fix
4+
5+
- Add back code that was used.
6+
#ShouldHaveHadUnitTests
7+
#TDDWouldHaveSolvedThis

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
77
and is generated by [Changie](https://github.com/miniscruff/changie).
88

9+
## v0.2.2 - 2023-05-10
10+
11+
### 🐛 Bug Fix
12+
13+
- Add back code that was used.
14+
#ShouldHaveHadUnitTests
15+
#TDDWouldHaveSolvedThis
16+
917
## v0.2.1 - 2023-05-10
1018

1119
### 🔨 Refactor

cmd/new.go

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
"github.com/AlecAivazis/survey/v2"
1515
"github.com/go-git/go-git/v5/plumbing"
16-
"github.com/maaslalani/confetty/confetti"
16+
1717
"github.com/magefile/mage/sh"
1818

1919
"github.com/go-git/go-git/v5"
@@ -362,3 +362,64 @@ func createPR() {
362362

363363
time.Sleep(1 * time.Second)
364364
}
365+
366+
type (
367+
errMsg error
368+
model struct {
369+
textarea textarea.Model
370+
err error
371+
}
372+
)
373+
374+
func initialModel() model {
375+
ti := textarea.New()
376+
ti.Placeholder = "- Implement tacos in app..."
377+
ti.Focus()
378+
return model{
379+
textarea: ti,
380+
err: nil,
381+
}
382+
}
383+
384+
func (m model) Init() tea.Cmd {
385+
return textarea.Blink
386+
}
387+
388+
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
389+
var cmds []tea.Cmd
390+
var cmd tea.Cmd
391+
switch msg := msg.(type) {
392+
case tea.KeyMsg:
393+
switch msg.Type {
394+
case tea.KeyEsc:
395+
if m.textarea.Focused() {
396+
m.textarea.Blur()
397+
}
398+
case tea.KeyCtrlC:
399+
pterm.Warning.Println("ctrl+c pressed. exiting... make up your mind please")
400+
os.Exit(0)
401+
case tea.KeyCtrlD:
402+
return m, tea.Quit
403+
default:
404+
if !m.textarea.Focused() {
405+
cmd = m.textarea.Focus()
406+
cmds = append(cmds, cmd)
407+
}
408+
}
409+
// We handle errors just like any other message
410+
case errMsg:
411+
m.err = msg
412+
return m, nil
413+
}
414+
m.textarea, cmd = m.textarea.Update(msg)
415+
cmds = append(cmds, cmd)
416+
return m, tea.Batch(cmds...)
417+
}
418+
419+
func (m model) View() string {
420+
return fmt.Sprintf(
421+
"Summary of changes and why?\n\n%s\n\n%s",
422+
m.textarea.View(),
423+
"(ctrl+d to save, ctrl+c to quit)",
424+
) + "\n\n"
425+
}

cmd/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
package cmd
22

33
// version is the semver version, and is updated by changie
4-
var version string = "v0.2.1"
4+
var version string = "v0.2.2"

0 commit comments

Comments
 (0)