From 128c283ea721226edf1d61167cd6c5c3f4edcfac Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 13 Jan 2023 14:36:07 -0500 Subject: [PATCH] seriousbusiness --- cmd/zrok/enable.go | 10 +++++----- cmd/zrok/invite.go | 14 +++++++------- cmd/zrok/sharePrivate.go | 2 +- cmd/zrok/shareReserved.go | 2 +- cmd/zrok/status.go | 6 +++--- cmd/zrok/version.go | 4 +--- tui/messages.go | 10 +++++----- 7 files changed, 23 insertions(+), 25 deletions(-) diff --git a/cmd/zrok/enable.go b/cmd/zrok/enable.go index a8efdc0d..b536df6a 100644 --- a/cmd/zrok/enable.go +++ b/cmd/zrok/enable.go @@ -115,11 +115,11 @@ func (cmd *enableCommand) run(_ *cobra.Command, args []string) { } func (cmd *enableCommand) endpointError(apiEndpoint, _ string) { - fmt.Printf("%v\n\n", tui.ErrorStyle.Render("there was a problem enabling your environment!")) - fmt.Printf("you are trying to use the zrok service at: %v\n\n", tui.CodeStyle.Render(apiEndpoint)) + fmt.Printf("%v\n\n", tui.SeriousBusiness.Render("there was a problem enabling your environment!")) + fmt.Printf("you are trying to use the zrok service at: %v\n\n", tui.Code.Render(apiEndpoint)) fmt.Printf("you can change your zrok service endpoint using this command:\n\n") - fmt.Printf("%v\n\n", tui.CodeStyle.Render("$ zrok config set apiEndpoint ")) - fmt.Printf("(where newEndpoint is something like: %v)\n\n", tui.CodeStyle.Render("https://some.zrok.io")) + fmt.Printf("%v\n\n", tui.Code.Render("$ zrok config set apiEndpoint ")) + fmt.Printf("(where newEndpoint is something like: %v)\n\n", tui.Code.Render("https://some.zrok.io")) } func getHost() (string, string, error) { @@ -141,7 +141,7 @@ type enableTuiModel struct { func newEnableTuiModel() enableTuiModel { s := spinner.New() s.Spinner = spinner.Dot - s.Style = tui.WarningStyle + s.Style = tui.Attention return enableTuiModel{spinner: s} } diff --git a/cmd/zrok/invite.go b/cmd/zrok/invite.go index 27bf0659..9c855fbf 100644 --- a/cmd/zrok/invite.go +++ b/cmd/zrok/invite.go @@ -81,11 +81,11 @@ func (cmd *inviteCommand) run(_ *cobra.Command, _ []string) { } func (cmd *inviteCommand) endpointError(apiEndpoint, _ string) { - fmt.Printf("%v\n\n", tui.ErrorStyle.Render("there was a problem creating an invitation!")) - fmt.Printf("you are trying to use the zrok service at: %v\n\n", tui.CodeStyle.Render(apiEndpoint)) + fmt.Printf("%v\n\n", tui.SeriousBusiness.Render("there was a problem creating an invitation!")) + fmt.Printf("you are trying to use the zrok service at: %v\n\n", tui.Code.Render(apiEndpoint)) fmt.Printf("you can change your zrok service endpoint using this command:\n\n") - fmt.Printf("%v\n\n", tui.CodeStyle.Render("$ zrok config set apiEndpoint ")) - fmt.Printf("(where newEndpoint is something like: %v)\n\n", tui.CodeStyle.Render("https://some.zrok.io")) + fmt.Printf("%v\n\n", tui.Code.Render("$ zrok config set apiEndpoint ")) + fmt.Printf("(where newEndpoint is something like: %v)\n\n", tui.Code.Render("https://some.zrok.io")) } type inviteTui struct { @@ -111,9 +111,9 @@ func newInviteTui() inviteTui { m := inviteTui{ inputs: make([]textinput.Model, 2), } - m.focusedStyle = tui.WarningStyle.Copy() - m.blurredStyle = tui.CodeStyle.Copy() - m.errorStyle = tui.ErrorStyle.Copy() + m.focusedStyle = tui.Attention.Copy() + m.blurredStyle = tui.Code.Copy() + m.errorStyle = tui.SeriousBusiness.Copy() m.cursorStyle = m.focusedStyle.Copy() m.noStyle = lipgloss.NewStyle() m.helpStyle = m.blurredStyle.Copy() diff --git a/cmd/zrok/sharePrivate.go b/cmd/zrok/sharePrivate.go index 851ebc20..2e380449 100644 --- a/cmd/zrok/sharePrivate.go +++ b/cmd/zrok/sharePrivate.go @@ -184,7 +184,7 @@ func (cmd *sharePrivateCommand) run(_ *cobra.Command, args []string) { } } else { - shareDescription := fmt.Sprintf("access your share with: %v", tui.CodeStyle.Render(fmt.Sprintf("zrok access private %v", resp.Payload.ShrToken))) + shareDescription := fmt.Sprintf("access your share with: %v", tui.Code.Render(fmt.Sprintf("zrok access private %v", resp.Payload.ShrToken))) mdl := newShareModel(resp.Payload.ShrToken, []string{shareDescription}, "private", cmd.backendMode) logrus.SetOutput(mdl) prg := tea.NewProgram(mdl, tea.WithAltScreen()) diff --git a/cmd/zrok/shareReserved.go b/cmd/zrok/shareReserved.go index f57f381f..de6d9107 100644 --- a/cmd/zrok/shareReserved.go +++ b/cmd/zrok/shareReserved.go @@ -159,7 +159,7 @@ func (cmd *shareReservedCommand) run(_ *cobra.Command, args []string) { case "public": shareDescription = resp.Payload.FrontendEndpoint case "private": - shareDescription = fmt.Sprintf("access your share with: %v", tui.CodeStyle.Render(fmt.Sprintf("zrok access private %v", shrToken))) + shareDescription = fmt.Sprintf("access your share with: %v", tui.Code.Render(fmt.Sprintf("zrok access private %v", shrToken))) } mdl := newShareModel(shrToken, []string{shareDescription}, resp.Payload.ShareMode, resp.Payload.BackendMode) diff --git a/cmd/zrok/status.go b/cmd/zrok/status.go index 2f70e52e..36e071a1 100644 --- a/cmd/zrok/status.go +++ b/cmd/zrok/status.go @@ -37,7 +37,7 @@ func (cmd *statusCommand) run(_ *cobra.Command, _ []string) { tui.Error("unable to load zrokdir", err) } - _, _ = fmt.Fprintf(os.Stdout, tui.CodeStyle.Render("Config")+":\n\n") + _, _ = fmt.Fprintf(os.Stdout, tui.Code.Render("Config")+":\n\n") t := table.NewWriter() t.SetOutputMirror(os.Stdout) t.SetStyle(table.StyleColoredDark) @@ -49,9 +49,9 @@ func (cmd *statusCommand) run(_ *cobra.Command, _ []string) { if zrd.Env == nil { tui.Warning("Unable to load your local environment!\n") - _, _ = fmt.Fprintf(os.Stderr, "To create a local environment use the %v command.\n", tui.CodeStyle.Render("zrok enable")) + _, _ = fmt.Fprintf(os.Stderr, "To create a local environment use the %v command.\n", tui.Code.Render("zrok enable")) } else { - _, _ = fmt.Fprintf(os.Stdout, tui.CodeStyle.Render("Environment")+":\n\n") + _, _ = fmt.Fprintf(os.Stdout, tui.Code.Render("Environment")+":\n\n") t := table.NewWriter() t.SetOutputMirror(os.Stdout) diff --git a/cmd/zrok/version.go b/cmd/zrok/version.go index 23079c1a..52865b9f 100644 --- a/cmd/zrok/version.go +++ b/cmd/zrok/version.go @@ -2,7 +2,6 @@ package main import ( "fmt" - "github.com/charmbracelet/lipgloss" "github.com/openziti-test-kitchen/zrok/build" "github.com/openziti-test-kitchen/zrok/tui" "github.com/spf13/cobra" @@ -27,6 +26,5 @@ func newVersionCommand() *versionCommand { } func (cmd *versionCommand) run(_ *cobra.Command, _ []string) { - zrokStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("#FF00EE")) - fmt.Println(zrokStyle.Render(" _ \n _____ __ ___ | | __\n|_ / '__/ _ \\| |/ /\n / /| | | (_) | < \n/___|_| \\___/|_|\\_\\") + "\n\n" + tui.CodeStyle.Render(build.String()) + "\n") + fmt.Println(tui.SeriousBusiness.Render(" _ \n _____ __ ___ | | __\n|_ / '__/ _ \\| |/ /\n / /| | | (_) | < \n/___|_| \\___/|_|\\_\\") + "\n\n" + tui.Code.Render(build.String()) + "\n") } diff --git a/tui/messages.go b/tui/messages.go index 5c67251c..55ddabb5 100644 --- a/tui/messages.go +++ b/tui/messages.go @@ -7,11 +7,11 @@ import ( "strings" ) -var ErrorStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#D90166")) -var ErrorLabel = ErrorStyle.Render("ERROR") -var WarningStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#FFA500")) -var WarningLabel = WarningStyle.Render("WARNING") -var CodeStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#00FFFF")) +var SeriousBusiness = lipgloss.NewStyle().Foreground(lipgloss.Color("#D90166")) +var ErrorLabel = SeriousBusiness.Render("ERROR") +var Attention = lipgloss.NewStyle().Foreground(lipgloss.Color("#FFA500")) +var WarningLabel = Attention.Render("WARNING") +var Code = lipgloss.NewStyle().Foreground(lipgloss.Color("#00FFFF")) func Error(msg string, err error) { if err != nil {