From 94a74c64b7501026ebfe7e546f8f4ffad6cdfa47 Mon Sep 17 00:00:00 2001 From: Aykhan Shahsuvarov Date: Tue, 10 Sep 2024 21:04:13 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Set=20max=20table=20column=20wit?= =?UTF-8?q?h=20in=20config=20and=20response=20packages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.go | 4 +++- main.go | 6 +++--- requests/response.go | 5 ++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/config/config.go b/config/config.go index 443426a..70acb2b 100644 --- a/config/config.go +++ b/config/config.go @@ -42,7 +42,9 @@ func (config *RequestConfig) Print() { t := table.NewWriter() t.SetOutputMirror(os.Stdout) t.SetStyle(table.StyleLight) - t.SetAllowedRowLength(125) + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 2, WidthMax: 50}, + }) t.AppendHeader(table.Row{"Request Configuration"}) t.AppendRow(table.Row{"Method", config.Method}) diff --git a/main.go b/main.go index d4b1991..da8aae0 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package main import ( "context" + "fmt" "net/url" "os" "os/signal" @@ -84,11 +85,10 @@ func main() { requestConf.Print() if !cliConf.Yes { response := readers.CLIYesOrNoReader("Do you want to continue?", true) - if response { - utils.PrintlnC(utils.Colors.Green, "Starting Dodo\n") - } else { + if !response { utils.PrintAndExit("Exiting...") } + fmt.Println() } ctx, cancel := context.WithCancel(context.Background()) diff --git a/requests/response.go b/requests/response.go index 70a103a..82cdbc5 100644 --- a/requests/response.go +++ b/requests/response.go @@ -57,7 +57,10 @@ func (respones Responses) Print() { t := table.NewWriter() t.SetOutputMirror(os.Stdout) t.SetStyle(table.StyleLight) - t.SetAllowedRowLength(125) + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 1, WidthMax: 80}, + }) + t.AppendHeader(table.Row{ "Response", "Count",