seriousbusiness

This commit is contained in:
Michael Quigley 2023-01-13 14:36:07 -05:00
parent 0d43b5566b
commit 128c283ea7
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
7 changed files with 23 additions and 25 deletions

View File

@ -115,11 +115,11 @@ func (cmd *enableCommand) run(_ *cobra.Command, args []string) {
} }
func (cmd *enableCommand) endpointError(apiEndpoint, _ string) { func (cmd *enableCommand) endpointError(apiEndpoint, _ string) {
fmt.Printf("%v\n\n", tui.ErrorStyle.Render("there was a problem enabling your environment!")) 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.CodeStyle.Render(apiEndpoint)) 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("you can change your zrok service endpoint using this command:\n\n")
fmt.Printf("%v\n\n", tui.CodeStyle.Render("$ zrok config set apiEndpoint <newEndpoint>")) fmt.Printf("%v\n\n", tui.Code.Render("$ zrok config set apiEndpoint <newEndpoint>"))
fmt.Printf("(where newEndpoint is something like: %v)\n\n", tui.CodeStyle.Render("https://some.zrok.io")) fmt.Printf("(where newEndpoint is something like: %v)\n\n", tui.Code.Render("https://some.zrok.io"))
} }
func getHost() (string, string, error) { func getHost() (string, string, error) {
@ -141,7 +141,7 @@ type enableTuiModel struct {
func newEnableTuiModel() enableTuiModel { func newEnableTuiModel() enableTuiModel {
s := spinner.New() s := spinner.New()
s.Spinner = spinner.Dot s.Spinner = spinner.Dot
s.Style = tui.WarningStyle s.Style = tui.Attention
return enableTuiModel{spinner: s} return enableTuiModel{spinner: s}
} }

View File

@ -81,11 +81,11 @@ func (cmd *inviteCommand) run(_ *cobra.Command, _ []string) {
} }
func (cmd *inviteCommand) endpointError(apiEndpoint, _ string) { func (cmd *inviteCommand) endpointError(apiEndpoint, _ string) {
fmt.Printf("%v\n\n", tui.ErrorStyle.Render("there was a problem creating an invitation!")) 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.CodeStyle.Render(apiEndpoint)) 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("you can change your zrok service endpoint using this command:\n\n")
fmt.Printf("%v\n\n", tui.CodeStyle.Render("$ zrok config set apiEndpoint <newEndpoint>")) fmt.Printf("%v\n\n", tui.Code.Render("$ zrok config set apiEndpoint <newEndpoint>"))
fmt.Printf("(where newEndpoint is something like: %v)\n\n", tui.CodeStyle.Render("https://some.zrok.io")) fmt.Printf("(where newEndpoint is something like: %v)\n\n", tui.Code.Render("https://some.zrok.io"))
} }
type inviteTui struct { type inviteTui struct {
@ -111,9 +111,9 @@ func newInviteTui() inviteTui {
m := inviteTui{ m := inviteTui{
inputs: make([]textinput.Model, 2), inputs: make([]textinput.Model, 2),
} }
m.focusedStyle = tui.WarningStyle.Copy() m.focusedStyle = tui.Attention.Copy()
m.blurredStyle = tui.CodeStyle.Copy() m.blurredStyle = tui.Code.Copy()
m.errorStyle = tui.ErrorStyle.Copy() m.errorStyle = tui.SeriousBusiness.Copy()
m.cursorStyle = m.focusedStyle.Copy() m.cursorStyle = m.focusedStyle.Copy()
m.noStyle = lipgloss.NewStyle() m.noStyle = lipgloss.NewStyle()
m.helpStyle = m.blurredStyle.Copy() m.helpStyle = m.blurredStyle.Copy()

View File

@ -184,7 +184,7 @@ func (cmd *sharePrivateCommand) run(_ *cobra.Command, args []string) {
} }
} else { } 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) mdl := newShareModel(resp.Payload.ShrToken, []string{shareDescription}, "private", cmd.backendMode)
logrus.SetOutput(mdl) logrus.SetOutput(mdl)
prg := tea.NewProgram(mdl, tea.WithAltScreen()) prg := tea.NewProgram(mdl, tea.WithAltScreen())

View File

@ -159,7 +159,7 @@ func (cmd *shareReservedCommand) run(_ *cobra.Command, args []string) {
case "public": case "public":
shareDescription = resp.Payload.FrontendEndpoint shareDescription = resp.Payload.FrontendEndpoint
case "private": 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) mdl := newShareModel(shrToken, []string{shareDescription}, resp.Payload.ShareMode, resp.Payload.BackendMode)

View File

@ -37,7 +37,7 @@ func (cmd *statusCommand) run(_ *cobra.Command, _ []string) {
tui.Error("unable to load zrokdir", err) 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 := table.NewWriter()
t.SetOutputMirror(os.Stdout) t.SetOutputMirror(os.Stdout)
t.SetStyle(table.StyleColoredDark) t.SetStyle(table.StyleColoredDark)
@ -49,9 +49,9 @@ func (cmd *statusCommand) run(_ *cobra.Command, _ []string) {
if zrd.Env == nil { if zrd.Env == nil {
tui.Warning("Unable to load your local environment!\n") 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 { } 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 := table.NewWriter()
t.SetOutputMirror(os.Stdout) t.SetOutputMirror(os.Stdout)

View File

@ -2,7 +2,6 @@ package main
import ( import (
"fmt" "fmt"
"github.com/charmbracelet/lipgloss"
"github.com/openziti-test-kitchen/zrok/build" "github.com/openziti-test-kitchen/zrok/build"
"github.com/openziti-test-kitchen/zrok/tui" "github.com/openziti-test-kitchen/zrok/tui"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -27,6 +26,5 @@ func newVersionCommand() *versionCommand {
} }
func (cmd *versionCommand) run(_ *cobra.Command, _ []string) { func (cmd *versionCommand) run(_ *cobra.Command, _ []string) {
zrokStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("#FF00EE")) fmt.Println(tui.SeriousBusiness.Render(" _ \n _____ __ ___ | | __\n|_ / '__/ _ \\| |/ /\n / /| | | (_) | < \n/___|_| \\___/|_|\\_\\") + "\n\n" + tui.Code.Render(build.String()) + "\n")
fmt.Println(zrokStyle.Render(" _ \n _____ __ ___ | | __\n|_ / '__/ _ \\| |/ /\n / /| | | (_) | < \n/___|_| \\___/|_|\\_\\") + "\n\n" + tui.CodeStyle.Render(build.String()) + "\n")
} }

View File

@ -7,11 +7,11 @@ import (
"strings" "strings"
) )
var ErrorStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#D90166")) var SeriousBusiness = lipgloss.NewStyle().Foreground(lipgloss.Color("#D90166"))
var ErrorLabel = ErrorStyle.Render("ERROR") var ErrorLabel = SeriousBusiness.Render("ERROR")
var WarningStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#FFA500")) var Attention = lipgloss.NewStyle().Foreground(lipgloss.Color("#FFA500"))
var WarningLabel = WarningStyle.Render("WARNING") var WarningLabel = Attention.Render("WARNING")
var CodeStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#00FFFF")) var Code = lipgloss.NewStyle().Foreground(lipgloss.Color("#00FFFF"))
func Error(msg string, err error) { func Error(msg string, err error) {
if err != nil { if err != nil {