Skip to content

Commit

Permalink
remove internal folder
Browse files Browse the repository at this point in the history
  • Loading branch information
João Pedro Magalhães committed Mar 23, 2022
1 parent 5c12470 commit d85e501
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 11 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"

tea "github.com/charmbracelet/bubbletea"
"github.com/joaom00/gh-b/internal/tui"
"github.com/joaom00/gh-b/tui"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion internal/tui/create.go → tui/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/joaom00/gh-b/internal/git"
"github.com/joaom00/gh-b/git"
)

type createModel struct {
Expand Down
4 changes: 2 additions & 2 deletions internal/tui/delegate.go → tui/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/list"
tea "github.com/charmbracelet/bubbletea"
"github.com/joaom00/gh-b/internal/tui/keys"
"github.com/joaom00/gh-b/internal/tui/styles"
"github.com/joaom00/gh-b/tui/keys"
"github.com/joaom00/gh-b/tui/styles"
)

type itemDelegate struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/tui/delete.go → tui/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/joaom00/gh-b/internal/git"
"github.com/joaom00/gh-b/git"
)

type deleteModel struct {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/tui/merge.go → tui/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/joaom00/gh-b/internal/git"
"github.com/joaom00/gh-b/git"
)

type mergeModel struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/tui/rebase.go → tui/rebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/joaom00/gh-b/internal/git"
"github.com/joaom00/gh-b/git"
)

type rebaseModel struct {
Expand Down
39 changes: 39 additions & 0 deletions tui/rename.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package tui

import (
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
)

type renameModel struct {
input textinput.Model
}

func newRenameModel() *renameModel {
ti := textinput.New()

return &renameModel{
input: ti,
}
}

func renameUpdate(msg tea.Msg, m Model) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
switch {
case key.Matches(msg, m.keyMap.Enter):
return m, nil
}
}

return m, nil
}

func (m Model) renameView() string {
return lipgloss.NewStyle().
MarginTop(1).
MarginLeft(4).
Render(lipgloss.JoinVertical(lipgloss.Left, m.rename.input.View()))
}
File renamed without changes.
9 changes: 5 additions & 4 deletions internal/tui/tui.go → tui/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/list"
tea "github.com/charmbracelet/bubbletea"
"github.com/joaom00/gh-b/internal/git"
"github.com/joaom00/gh-b/internal/tui/keys"
"github.com/joaom00/gh-b/internal/tui/styles"
"github.com/joaom00/gh-b/git"
"github.com/joaom00/gh-b/tui/keys"
"github.com/joaom00/gh-b/tui/styles"
)

const (
Expand All @@ -33,11 +33,11 @@ const (
)

type Model struct {
items []item
create *createModel
delete *deleteModel
merge *mergeModel
rebase *rebaseModel
rename *renameModel
keyMap *keys.KeyMap
list list.Model
styles styles.Styles
Expand Down Expand Up @@ -73,6 +73,7 @@ func NewModel() Model {
delete: newDeleteModel(),
merge: newMergeModel(),
rebase: newRebaseModel(),
rename: newRenameModel(),
keyMap: keys,
list: l,
styles: styles,
Expand Down

0 comments on commit d85e501

Please sign in to comment.