Skip to content

Commit

Permalink
Merge pull request #69 from viktomas/do-not-export
Browse files Browse the repository at this point in the history
Don't export main package functions
  • Loading branch information
viktomas authored Apr 21, 2019
2 parents dc23d94 + bf5cf65 commit f0108a9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions godu.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func main() {
var wg sync.WaitGroup
wg.Add(3)
go core.StartProcessing(rootFolder, commands, states, lastStateChan, &wg)
go InteractiveFolder(s, states, &wg)
go ParseCommand(s, commands, &wg)
go interactiveFolder(s, states, &wg)
go parseCommand(s, commands, &wg)
wg.Wait()
s.Fini()
lastState := <-lastStateChan
Expand Down
2 changes: 1 addition & 1 deletion interactive/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func FilesAsSlice(in map[*core.File]struct{}) []string {
p := file.Path()
out = append(out, p)
}
// sorting lenght of the path (assuming that we want to deleate files in subdirs first)
// sorting length of the path (assuming that we want to delete files in subdirs first)
// alphabetical sorting added for determinism (map keys doesn't guarantee order)
sort.Sort(sort.StringSlice(out))
sort.Sort(byLength(out))
Expand Down
2 changes: 1 addition & 1 deletion parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/viktomas/godu/core"
)

func ParseCommand(s tcell.Screen, commands chan core.Executer, wg *sync.WaitGroup) {
func parseCommand(s tcell.Screen, commands chan core.Executer, wg *sync.WaitGroup) {
defer wg.Done()
for {
ev := s.PollEvent()
Expand Down
16 changes: 8 additions & 8 deletions state_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (
"github.com/viktomas/godu/interactive"
)

type VisualState struct {
type visualState struct {
folders []interactive.Line
selected int
xbound, ybound int
}

func NewVisualState(state core.State) VisualState {
func newVisualState(state core.State) visualState {
lines := interactive.ReportFolder(state.Folder, state.MarkedFiles)
xbound := 0
ybound := len(lines)
Expand All @@ -22,10 +22,10 @@ func NewVisualState(state core.State) VisualState {
}
lines[index] = line
}
return VisualState{lines, state.Selected, xbound, ybound}
return visualState{lines, state.Selected, xbound, ybound}
}

func (vs VisualState) GetCell(x, y int) (rune, tcell.Style, []rune, int) {
func (vs visualState) GetCell(x, y int) (rune, tcell.Style, []rune, int) {
style := tcell.StyleDefault
if y == vs.selected {
style = style.Reverse(true)
Expand All @@ -41,15 +41,15 @@ func (vs VisualState) GetCell(x, y int) (rune, tcell.Style, []rune, int) {
}
return ' ', style, nil, 1
}
func (vs VisualState) GetBounds() (int, int) {
func (vs visualState) GetBounds() (int, int) {
return vs.xbound, vs.ybound
}
func (VisualState) SetCursor(int, int) {
func (visualState) SetCursor(int, int) {
}

func (VisualState) GetCursor() (int, int, bool, bool) {
func (visualState) GetCursor() (int, int, bool, bool) {
return 0, 0, false, false
}
func (VisualState) MoveCursor(offx, offy int) {
func (visualState) MoveCursor(offx, offy int) {

}
8 changes: 4 additions & 4 deletions state_presenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/viktomas/godu/interactive"
)

func InteractiveFolder(s tcell.Screen, states chan core.State, wg *sync.WaitGroup) {
func interactiveFolder(s tcell.Screen, states chan core.State, wg *sync.WaitGroup) {
defer wg.Done()
for {
state, more := <-states
Expand All @@ -29,19 +29,19 @@ func printOptions(state core.State, s tcell.Screen) {

middle := views.NewCellView()

middle.SetModel(NewVisualState(state))
middle.SetModel(newVisualState(state))
backState, err := core.GoBack{}.Execute(state)
if err == nil {
backCell := views.NewCellView()
backCell.SetModel(NewVisualState(backState))
backCell.SetModel(newVisualState(backState))
back = backCell
} else {
back = views.NewText()
}
forthState, err := core.Enter{}.Execute(state)
if err == nil {
forthCell := views.NewCellView()
forthCell.SetModel(NewVisualState(forthState))
forthCell.SetModel(newVisualState(forthState))
forth = forthCell
} else {
forth = views.NewText()
Expand Down

0 comments on commit f0108a9

Please sign in to comment.