Skip to content

Commit

Permalink
Add DefaultText
Browse files Browse the repository at this point in the history
  • Loading branch information
hatsu38 committed Aug 23, 2021
1 parent 963aeeb commit 5003413
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ type Gui struct {
HTTPTextView *tview.TextView
}

var (
defaultText = `
_ _ _
_ __ ___ ___| |_ _ __ ___ __ _ _ __ | |_ _ _(_)
| '_ \ / _ \/ __| __| '_ ' _ \ / _' | '_ \ _____| __| | | | |
| |_) | (_) \__ \ |_| | | | | | (_| | | | |_____| |_| |_| | |
| .__/ \___/|___/\__|_| |_| |_|\__,_|_| |_| \__|\__,_|_|
|_|`
)

type Param struct {
Key string
Value string
Expand All @@ -36,14 +46,14 @@ func New() *Gui {
UrlField: NewForm(" Request URL: ", "https://httpbin.org/get"),
ParamsTable: NewTable(),
BodyTable: NewTable(),
ResTextView: NewTextView(" Response ", ""),
HTTPTextView: NewTextView(" HTTP Method ", "GET"),
ResTextView: NewTextView(" Response ", defaultText),
HTTPTextView: NewTextView(" HTTP ", "GET"),
}
return g
}

func NewApplication() *tview.Application {
return tview.NewApplication().EnableMouse(true)
return tview.NewApplication()
}

func NewForm(label, text string) *tview.InputField {
Expand Down Expand Up @@ -248,6 +258,8 @@ func (g *Gui) ToFocus() {
g.ToHTTPFieldFocus()
case g.HTTPTextView:
g.ToUrlFieldFocus()
default:
g.ToUrlFieldFocus()
}
}

Expand Down

0 comments on commit 5003413

Please sign in to comment.