diff --git a/cmd/aws/command.go b/cmd/aws/command.go index e0984836e..629a86ee5 100644 --- a/cmd/aws/command.go +++ b/cmd/aws/command.go @@ -61,7 +61,7 @@ func Create() *cobra.Command { Short: "create the kubefirst platform running in aws", TraverseChildren: true, RunE: createAws, - PreRun: common.CheckDocker, + // PreRun: common.CheckDocker, } // todo review defaults and update descriptions @@ -88,11 +88,11 @@ func Create() *cobra.Command { func Destroy() *cobra.Command { destroyCmd := &cobra.Command{ - Use: "destroy", - Short: "destroy the kubefirst platform", - Long: "deletes the GitHub resources, aws resources, and local content to re-provision", - RunE: common.Destroy, - PreRun: common.CheckDocker, + Use: "destroy", + Short: "destroy the kubefirst platform", + Long: "deletes the GitHub resources, aws resources, and local content to re-provision", + RunE: common.Destroy, + // PreRun: common.CheckDocker, } return destroyCmd diff --git a/cmd/civo/command.go b/cmd/civo/command.go index 2e3b2cfd8..59f5c76b2 100644 --- a/cmd/civo/command.go +++ b/cmd/civo/command.go @@ -72,7 +72,7 @@ func Create() *cobra.Command { Short: "create the kubefirst platform running on civo kubernetes", TraverseChildren: true, RunE: createCivo, - PreRun: common.CheckDocker, + // PreRun: common.CheckDocker, } // todo review defaults and update descriptions @@ -98,11 +98,11 @@ func Create() *cobra.Command { func Destroy() *cobra.Command { destroyCmd := &cobra.Command{ - Use: "destroy", - Short: "destroy the kubefirst platform", - Long: "destroy the kubefirst platform running in civo and remove all resources", - RunE: common.Destroy, - PreRun: common.CheckDocker, + Use: "destroy", + Short: "destroy the kubefirst platform", + Long: "destroy the kubefirst platform running in civo and remove all resources", + RunE: common.Destroy, + // PreRun: common.CheckDocker, } return destroyCmd diff --git a/cmd/digitalocean/command.go b/cmd/digitalocean/command.go index 3d23f460a..78d04aa43 100644 --- a/cmd/digitalocean/command.go +++ b/cmd/digitalocean/command.go @@ -64,7 +64,7 @@ func Create() *cobra.Command { Short: "create the kubefirst platform running on DigitalOcean Kubernetes", TraverseChildren: true, RunE: createDigitalocean, - PreRun: common.CheckDocker, + // PreRun: common.CheckDocker, } // todo review defaults and update descriptions @@ -90,11 +90,11 @@ func Create() *cobra.Command { func Destroy() *cobra.Command { destroyCmd := &cobra.Command{ - Use: "destroy", - Short: "destroy the kubefirst platform", - Long: "destroy the kubefirst platform running in DigitalOcean and remove all resources", - RunE: common.Destroy, - PreRun: common.CheckDocker, + Use: "destroy", + Short: "destroy the kubefirst platform", + Long: "destroy the kubefirst platform running in DigitalOcean and remove all resources", + RunE: common.Destroy, + // PreRun: common.CheckDocker, } return destroyCmd diff --git a/cmd/google/command.go b/cmd/google/command.go index 288b9c6ae..c2e80e1ae 100644 --- a/cmd/google/command.go +++ b/cmd/google/command.go @@ -67,7 +67,7 @@ func Create() *cobra.Command { Short: "create the kubefirst platform running on GCP kubernetes", TraverseChildren: true, RunE: createGoogle, - PreRun: common.CheckDocker, + // PreRun: common.CheckDocker, } // todo review defaults and update descriptions @@ -95,11 +95,11 @@ func Create() *cobra.Command { func Destroy() *cobra.Command { destroyCmd := &cobra.Command{ - Use: "destroy", - Short: "destroy the kubefirst platform", - Long: "destroy the kubefirst platform running in Goole and remove all resources", - RunE: common.Destroy, - PreRun: common.CheckDocker, + Use: "destroy", + Short: "destroy the kubefirst platform", + Long: "destroy the kubefirst platform running in Goole and remove all resources", + RunE: common.Destroy, + // PreRun: common.CheckDocker, } return destroyCmd diff --git a/cmd/k3d/create.go b/cmd/k3d/create.go index 9d694ea79..e659a6252 100644 --- a/cmd/k3d/create.go +++ b/cmd/k3d/create.go @@ -33,7 +33,6 @@ import ( "github.com/kubefirst/runtime/configs" "github.com/kubefirst/runtime/pkg" "github.com/kubefirst/runtime/pkg/argocd" - "github.com/kubefirst/runtime/pkg/docker" "github.com/kubefirst/runtime/pkg/gitClient" "github.com/kubefirst/runtime/pkg/github" gitlab "github.com/kubefirst/runtime/pkg/gitlab" @@ -148,14 +147,14 @@ func runK3d(cmd *cobra.Command, args []string) error { return fmt.Errorf("%s - this port is required to set up your kubefirst environment - please close any existing port forwards before continuing", err.Error()) } - // Verify Docker is running - dcli := docker.DockerClientWrapper{ - Client: docker.NewDockerClient(), - } - _, err = dcli.CheckDockerReady() - if err != nil { - return err - } + // Verify Docker is running # TODO: reintroduce once we support more runtimes + // dcli := docker.DockerClientWrapper{ + // Client: docker.NewDockerClient(), + // } + // _, err = dcli.CheckDockerReady() + // if err != nil { + // return err + // } // Global context var ctx context.Context diff --git a/cmd/launch.go b/cmd/launch.go index c40bdbedc..47c55b6df 100644 --- a/cmd/launch.go +++ b/cmd/launch.go @@ -9,7 +9,6 @@ package cmd import ( "fmt" - "github.com/kubefirst/kubefirst/internal/common" "github.com/kubefirst/kubefirst/internal/launch" "github.com/spf13/cobra" ) @@ -82,7 +81,7 @@ func launchListClusters() *cobra.Command { Use: "list", Short: "list clusters created by the kubefirst console", TraverseChildren: true, - PreRun: common.CheckDocker, + // PreRun: common.CheckDocker, Run: func(cmd *cobra.Command, args []string) { launch.ListClusters() }, @@ -97,7 +96,7 @@ func launchDeleteCluster() *cobra.Command { Use: "delete", Short: "delete a cluster created by the kubefirst console", TraverseChildren: true, - PreRun: common.CheckDocker, + // PreRun: common.CheckDocker, Args: func(cmd *cobra.Command, args []string) error { if err := cobra.ExactArgs(1)(cmd, args); err != nil { return fmt.Errorf("you must provide a cluster name as the only argument to this command") diff --git a/cmd/vultr/command.go b/cmd/vultr/command.go index 5745b7a7e..99f5d5b1f 100644 --- a/cmd/vultr/command.go +++ b/cmd/vultr/command.go @@ -65,7 +65,7 @@ func Create() *cobra.Command { Short: "create the kubefirst platform running on Vultr kubernetes", TraverseChildren: true, RunE: createVultr, - PreRun: common.CheckDocker, + // PreRun: common.CheckDocker, } // todo review defaults and update descriptions @@ -91,11 +91,11 @@ func Create() *cobra.Command { func Destroy() *cobra.Command { destroyCmd := &cobra.Command{ - Use: "destroy", - Short: "destroy the kubefirst platform", - Long: "destroy the kubefirst platform running in Vultr and remove all resources", - RunE: common.Destroy, - PreRun: common.CheckDocker, + Use: "destroy", + Short: "destroy the kubefirst platform", + Long: "destroy the kubefirst platform running in Vultr and remove all resources", + RunE: common.Destroy, + // PreRun: common.CheckDocker, } return destroyCmd diff --git a/internal/launch/constants.go b/internal/launch/constants.go index 99f03ade3..9f12d4cc5 100644 --- a/internal/launch/constants.go +++ b/internal/launch/constants.go @@ -11,7 +11,7 @@ const ( helmChartName = "kubefirst" helmChartRepoName = "kubefirst" helmChartRepoURL = "https://charts.kubefirst.com" - helmChartVersion = "2.3.1" + helmChartVersion = "2.3.2" namespace = "kubefirst" secretName = "kubefirst-initial-secrets" ) diff --git a/internal/progress/message.go b/internal/progress/message.go index d04b78719..d03d56439 100644 --- a/internal/progress/message.go +++ b/internal/progress/message.go @@ -11,6 +11,7 @@ package progress import ( "fmt" + "log" "strconv" "github.com/charmbracelet/glamour" @@ -20,11 +21,15 @@ import ( func renderMessage(message string) string { r, _ := glamour.NewTermRenderer( - glamour.WithStylesFromJSONFile("styles.json"), + glamour.WithStyles(StyleConfig), glamour.WithEmoji(), ) - out, _ := r.Render(message) + out, err := r.Render(message) + if err != nil { + log.Println(err.Error()) + return err.Error() + } return out } diff --git a/internal/progress/styles.go b/internal/progress/styles.go new file mode 100644 index 000000000..e1202e8f6 --- /dev/null +++ b/internal/progress/styles.go @@ -0,0 +1,230 @@ +package progress + +import "github.com/charmbracelet/glamour/ansi" + +var StyleConfig = ansi.StyleConfig{ + Document: ansi.StyleBlock{ + StylePrimitive: ansi.StylePrimitive{ + BlockPrefix: "", + BlockSuffix: "", + Color: stringPtr("252"), + }, + Margin: uintPtr(2), + }, + BlockQuote: ansi.StyleBlock{ + Indent: uintPtr(1), + IndentToken: stringPtr("│ "), + }, + List: ansi.StyleList{ + LevelIndent: 2, + }, + Heading: ansi.StyleBlock{ + StylePrimitive: ansi.StylePrimitive{ + BlockSuffix: "\n", + Color: stringPtr("39"), + Bold: boolPtr(true), + }, + }, + H1: ansi.StyleBlock{ + StylePrimitive: ansi.StylePrimitive{ + Prefix: " ", + Suffix: " ", + Color: stringPtr("288"), + BackgroundColor: stringPtr("63"), + Bold: boolPtr(true), + }, + }, + H2: ansi.StyleBlock{ + StylePrimitive: ansi.StylePrimitive{ + Prefix: "", + Color: stringPtr("99"), + }, + }, + H3: ansi.StyleBlock{ + StylePrimitive: ansi.StylePrimitive{ + Prefix: "", + Color: stringPtr("244"), + Bold: boolPtr(true), + }, + Margin: uintPtr(0), + }, + H4: ansi.StyleBlock{ + StylePrimitive: ansi.StylePrimitive{ + Prefix: "", + Color: stringPtr("70"), + }, + }, + H5: ansi.StyleBlock{ + StylePrimitive: ansi.StylePrimitive{ + Prefix: "", + Color: stringPtr("15"), + }, + Margin: uintPtr(0), + }, + H6: ansi.StyleBlock{ + StylePrimitive: ansi.StylePrimitive{ + Prefix: "###### ", + Color: stringPtr("35"), + Bold: boolPtr(false), + }, + }, + Strikethrough: ansi.StylePrimitive{ + CrossedOut: boolPtr(true), + }, + Emph: ansi.StylePrimitive{ + Italic: boolPtr(true), + }, + Strong: ansi.StylePrimitive{ + Bold: boolPtr(true), + }, + HorizontalRule: ansi.StylePrimitive{ + Color: stringPtr("240"), + Format: "\n--------\n", + }, + Item: ansi.StylePrimitive{ + BlockPrefix: "• ", + }, + Enumeration: ansi.StylePrimitive{ + BlockPrefix: ". ", + Color: stringPtr("#8be9fd"), + }, + Task: ansi.StyleTask{ + StylePrimitive: ansi.StylePrimitive{}, + Ticked: "[✓] ", + Unticked: "[ ] ", + }, + Link: ansi.StylePrimitive{ + Color: stringPtr("15"), + Underline: boolPtr(false), + }, + LinkText: ansi.StylePrimitive{ + Color: stringPtr("35"), + Bold: boolPtr(true), + }, + Image: ansi.StylePrimitive{ + Color: stringPtr("212"), + Underline: boolPtr(true), + }, + ImageText: ansi.StylePrimitive{ + Color: stringPtr("243"), + Format: "Image: {{.text}} →", + }, + Code: ansi.StyleBlock{ + StylePrimitive: ansi.StylePrimitive{ + Color: stringPtr("15"), + Prefix: " ", + Suffix: " ", + Bold: boolPtr(true), + BackgroundColor: stringPtr(""), + }, + }, + CodeBlock: ansi.StyleCodeBlock{ + StyleBlock: ansi.StyleBlock{ + StylePrimitive: ansi.StylePrimitive{ + Color: stringPtr("244"), + }, + Margin: uintPtr(2), + }, + Chroma: &ansi.Chroma{ + Text: ansi.StylePrimitive{ + Color: stringPtr("#f8f8f2"), + }, + Error: ansi.StylePrimitive{ + Color: stringPtr("#f8f8f2"), + BackgroundColor: stringPtr("#ff5555"), + }, + Comment: ansi.StylePrimitive{ + Color: stringPtr("#6272A4"), + }, + CommentPreproc: ansi.StylePrimitive{ + Color: stringPtr("#ff79c6"), + }, + Keyword: ansi.StylePrimitive{ + Color: stringPtr("#ff79c6"), + }, + KeywordReserved: ansi.StylePrimitive{ + Color: stringPtr("#ff79c6"), + }, + KeywordNamespace: ansi.StylePrimitive{ + Color: stringPtr("#ff79c6"), + }, + KeywordType: ansi.StylePrimitive{ + Color: stringPtr("#8be9fd"), + }, + Operator: ansi.StylePrimitive{ + Color: stringPtr("#ff79c6"), + }, + Punctuation: ansi.StylePrimitive{ + Color: stringPtr("#f8f8f2"), + }, + Name: ansi.StylePrimitive{ + Color: stringPtr("#8be9fd"), + }, + NameBuiltin: ansi.StylePrimitive{ + Color: stringPtr("#8be9fd"), + }, + NameTag: ansi.StylePrimitive{ + Color: stringPtr("#ff79c6"), + }, + NameAttribute: ansi.StylePrimitive{ + Color: stringPtr("#50fa7b"), + }, + NameClass: ansi.StylePrimitive{ + Color: stringPtr("#8be9fd"), + }, + NameConstant: ansi.StylePrimitive{ + Color: stringPtr("#bd93f9"), + }, + NameDecorator: ansi.StylePrimitive{ + Color: stringPtr("#50fa7b"), + }, + NameFunction: ansi.StylePrimitive{ + Color: stringPtr("#50fa7b"), + }, + LiteralNumber: ansi.StylePrimitive{ + Color: stringPtr("#6EEFC0"), + }, + LiteralString: ansi.StylePrimitive{ + Color: stringPtr("#f1fa8c"), + }, + LiteralStringEscape: ansi.StylePrimitive{ + Color: stringPtr("#ff79c6"), + }, + GenericDeleted: ansi.StylePrimitive{ + Color: stringPtr("#ff5555"), + }, + GenericEmph: ansi.StylePrimitive{ + Color: stringPtr("#f1fa8c"), + Italic: boolPtr(true), + }, + GenericInserted: ansi.StylePrimitive{ + Color: stringPtr("#50fa7b"), + }, + GenericStrong: ansi.StylePrimitive{ + Color: stringPtr("#ffb86c"), + Bold: boolPtr(true), + }, + GenericSubheading: ansi.StylePrimitive{ + Color: stringPtr("#bd93f9"), + }, + Background: ansi.StylePrimitive{ + BackgroundColor: stringPtr("#282a36"), + }, + }, + }, + Table: ansi.StyleTable{ + StyleBlock: ansi.StyleBlock{ + StylePrimitive: ansi.StylePrimitive{}, + }, + CenterSeparator: stringPtr("┼"), + ColumnSeparator: stringPtr("│"), + RowSeparator: stringPtr("─"), + }, + DefinitionDescription: ansi.StylePrimitive{ + BlockPrefix: "\n🠶 ", + }, +} + +func boolPtr(b bool) *bool { return &b } +func stringPtr(s string) *string { return &s } +func uintPtr(u uint) *uint { return &u } diff --git a/styles.json b/styles.json deleted file mode 100644 index b2e8667e2..000000000 --- a/styles.json +++ /dev/null @@ -1,203 +0,0 @@ -{ - "document": { - "block_prefix": "", - "block_suffix": "", - "color": "252", - "margin": 2 - }, - "block_quote": { - "indent": 1, - "indent_token": "│ " - }, - "paragraph": {}, - "list": { - "level_indent": 2 - }, - "heading": { - "block_suffix": "\n", - "color": "39", - "bold": true - }, - "h1": { - "prefix": " ", - "suffix": " ", - "color": "228", - "background_color": "63", - "bold": true - }, - "h2": { - "prefix": "", - "color": "99" - }, - "h3": { - "prefix": "", - "color": "244", - "bold": true, - "margin": 0 - }, - "h4": { - "prefix": "", - "color" : "70" - }, - "h5": { - "prefix": "", - "color": "15", - "margin": 0 - }, - "h6": { - "prefix": "###### ", - "color": "35", - "bold": false - }, - "text": {}, - "strikethrough": { - "crossed_out": true - }, - "emph": { - "italic": true - }, - "strong": { - "bold": true - }, - "hr": { - "color": "240", - "format": "\n--------\n" - }, - "item": { - "block_prefix": "• " - }, - "enumeration": { - "block_prefix": ". " - }, - "task": { - "ticked": "[✓] ", - "unticked": "[ ] " - }, - "link": { - "color": "15", - "underline": false - }, - "link_text": { - "color": "35", - "bold": true - }, - "image": { - "color": "212", - "underline": true - }, - "image_text": { - "color": "243", - "format": "Image: {{.text}} →" - }, - "code": { - "prefix": " ", - "suffix": " ", - "color": "15", - "background_color": "", - "bold": true - }, - "code_block": { - "color": "244", - "margin": 1, - "chroma": { - "text": { - "color": "#C4C4C4" - }, - "error": { - "color": "#F1F1F1", - "background_color": "#F05B5B" - }, - "comment": { - "color": "#676767" - }, - "comment_preproc": { - "color": "#FF875F" - }, - "keyword": { - "color": "#00AAFF" - }, - "keyword_reserved": { - "color": "#FF5FD2" - }, - "keyword_namespace": { - "color": "#FF5F87" - }, - "keyword_type": { - "color": "#6E6ED8" - }, - "operator": { - "color": "#EF8080" - }, - "punctuation": { - "color": "#E8E8A8" - }, - "name": { - "color": "#C4C4C4" - }, - "name_builtin": { - "color": "#FF8EC7" - }, - "name_tag": { - "color": "#B083EA" - }, - "name_attribute": { - "color": "#7A7AE6" - }, - "name_class": { - "color": "#F1F1F1", - "underline": true, - "bold": true - }, - "name_constant": {}, - "name_decorator": { - "color": "#FFFF87" - }, - "name_exception": {}, - "name_function": { - "color": "#00D787" - }, - "name_other": {}, - "literal": {}, - "literal_number": { - "color": "#6EEFC0" - }, - "literal_date": {}, - "literal_string": { - "color": "#C69669" - }, - "literal_string_escape": { - "color": "#AFFFD7" - }, - "generic_deleted": { - "color": "#FD5B5B" - }, - "generic_emph": { - "italic": true - }, - "generic_inserted": { - "color": "#00D787" - }, - "generic_strong": { - "bold": true - }, - "generic_subheading": { - "color": "#777777" - }, - "background": { - "background_color": "#373737" - } - } - }, - "table": { - "center_separator": "┼", - "column_separator": "│", - "row_separator": "─" - }, - "definition_list": {}, - "definition_term": {}, - "definition_description": { - "block_prefix": "\n🠶 " - }, - "html_block": {}, - "html_span": {} -} \ No newline at end of file