Skip to content

Commit

Permalink
drop horizontal flag
Browse files Browse the repository at this point in the history
  • Loading branch information
minefuto committed Aug 19, 2024
1 parent f34df7b commit 8336b3f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 25 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ $ go install github.com/minefuto/tp@latest
Usage of tp:
-c, --command Return commandline text
-h, --help Show help
--horizontal Split the view horizontally
-s, --shell string Select a shell to use (default "$SHELL")
-v, --version Show version
```
Expand Down
39 changes: 15 additions & 24 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ var (
)

var (
shell string
initCommand string
commandFlag bool
helpFlag bool
horizontalFlag bool
versionFlag bool
stdinBytes []byte
allowCommands = [...]string{"awk", "cut", "egrep", "grep", "head", "jq", "nl", "sed", "sort", "tail", "tr", "uniq", "vgrep", "wc", "yq"}
shell string
initCommand string
commandFlag bool
helpFlag bool
versionFlag bool
stdinBytes []byte
allowCommands = [...]string{"awk", "cut", "egrep", "grep", "head", "jq", "nl", "sed", "sort", "tail", "tr", "uniq", "vgrep", "wc", "yq"}
)

var getTerminalHeight = func() int {
Expand All @@ -55,21 +54,14 @@ func newTui() *tui {
stdoutPane := newStdoutViewPane()

flex := tview.NewFlex()
if horizontalFlag {
flex.SetDirection(tview.FlexRow).
AddItem(cliPane, 1, 0, false).
AddItem(stdinPane, 0, 1, false).
AddItem(stdoutPane, 0, 1, false)
} else {
viewPanes := tview.NewFlex()
viewPanes.SetDirection(tview.FlexColumn).
AddItem(stdinPane, 0, 1, false).
AddItem(stdoutPane, 0, 1, false)

flex.SetDirection(tview.FlexRow).
AddItem(cliPane, 1, 0, false).
AddItem(viewPanes, 0, 1, false)
}
viewPanes := tview.NewFlex()
viewPanes.SetDirection(tview.FlexColumn).
AddItem(stdinPane, 0, 1, false).
AddItem(stdoutPane, 0, 1, false)

flex.SetDirection(tview.FlexRow).
AddItem(cliPane, 1, 0, false).
AddItem(viewPanes, 0, 1, false)

t := &tui{
Application: tview.NewApplication(),
Expand Down Expand Up @@ -482,7 +474,6 @@ func (tt *textLineTransformer) Transform(dst, src []byte, atEOF bool) (nDst, nSr

func main() {
flag.BoolVarP(&helpFlag, "help", "h", false, "Show help")
flag.BoolVar(&horizontalFlag, "horizontal", false, "Split the view horizontally")
flag.BoolVarP(&versionFlag, "version", "v", false, "Show version")
flag.BoolVarP(&commandFlag, "command", "c", false, "Return commandline text")
flag.StringVarP(&shell, "shell", "s", os.Getenv("SHELL"), "Select a shell to use")
Expand Down

0 comments on commit 8336b3f

Please sign in to comment.