Skip to content

Commit 31d0397

Browse files
authored
Merge pull request #98 from foomo/fix-status
Fix status
2 parents ceae36d + a140a86 commit 31d0397

File tree

16 files changed

+229
-256
lines changed

16 files changed

+229
-256
lines changed

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
with:
2626
token: ${{ secrets.GITHUB_TOKEN }}
2727

28-
- uses: golangci/golangci-lint-action@v7
28+
- uses: golangci/golangci-lint-action@v8
2929
with:
3030
version: latest
3131

.golangci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
version: "2"
22
run:
33
go: 1.24.1
4-
build-tags:
5-
- safe
4+
build-tags: [safe]
65
modules-download-mode: readonly
76
linters:
87
default: none
@@ -121,7 +120,8 @@ linters:
121120
exhaustive:
122121
default-signifies-exhaustive: true
123122
goconst:
124-
ignore-strings: '!!.+'
123+
ignore-string-values:
124+
- '!!.+'
125125
gocritic:
126126
disabled-checks:
127127
- ifElseChain

.goreleaser.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ builds:
2424
- '7'
2525
flags:
2626
- -trimpath
27+
- -tags=safe
2728
ldflags:
2829
- -s -w -X github.com/foomo/squadron/cmd/actions.version={{.Version}}
2930

@@ -44,4 +45,4 @@ brews:
4445
homepage: "https://github.com/foomo/squadron"
4546
description: "CLI utility manage infrastructure as code with helm"
4647
test: |
47-
system "#{bin}/squadron --version"
48+
system "#{bin}/squadron version"

CODE_OF_CONDUCT.md

Lines changed: 0 additions & 128 deletions
This file was deleted.

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ doc:
2828
## Run tests
2929
test:
3030
# see https://github.com/pterm/pterm/issues/482
31-
#GO_TEST_TAGS=-skip go test -coverprofile=coverage.out -race -json ./... | gotestfmt
32-
@GO_TEST_TAGS=-skip go test -coverprofile=coverage.out -json ./... | gotestfmt
31+
@GO_TEST_TAGS=-skip go test -tags=safe -coverprofile=coverage.out -json ./... | gotestfmt
32+
#GO_TEST_TAGS=-skip go test -tags=safe -coverprofile=coverage.out -race -json ./... | gotestfmt
3333

3434
.PHONY: lint
3535
## Run linter
@@ -51,14 +51,16 @@ tidy:
5151
outdated:
5252
@go list -u -m -json all | go-mod-outdated -update -direct
5353

54+
.PHONY: install
5455
## Install binary
5556
install:
56-
@go build -o ${GOPATH}/bin/squadron cmd/main.go
57+
@go build -tags=safe -o ${GOPATH}/bin/squadron cmd/main.go
5758

59+
.PHONY: build
5860
## Build binary
5961
build:
6062
@mkdir -p bin
61-
@go build -o bin/squadron cmd/main.go
63+
@go build -tags=safe -o bin/squadron cmd/main.go
6264

6365
## === Utils ===
6466

cmd/actions/config.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ func NewConfig(c *viper.Viper) *cobra.Command {
3333
}
3434
}
3535

36-
pterm.Println(util.Highlight(sq.ConfigYAML()))
36+
out := sq.ConfigYAML()
37+
if !c.GetBool("raw") {
38+
out = util.Highlight(out)
39+
}
40+
pterm.Println(out)
3741

3842
return nil
3943
},
@@ -46,5 +50,8 @@ func NewConfig(c *viper.Viper) *cobra.Command {
4650
flags.StringSlice("tags", nil, "list of tags to include or exclude (can specify multiple or separate values with commas: tag1,tag2,-tag3)")
4751
_ = c.BindPFlag("tags", flags.Lookup("tags"))
4852

53+
flags.Bool("raw", false, "print raw output without highlighting")
54+
_ = c.BindPFlag("raw", flags.Lookup("raw"))
55+
4956
return cmd
5057
}

cmd/actions/diff.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ func NewDiff(c *viper.Viper) *cobra.Command {
4141
return err
4242
}
4343

44-
pterm.Println(util.Highlight(out))
44+
if !c.GetBool("raw") {
45+
out = util.Highlight(out)
46+
}
47+
pterm.Println(out)
4548

4649
return nil
4750
},
@@ -57,5 +60,8 @@ func NewDiff(c *viper.Viper) *cobra.Command {
5760
flags.StringSlice("tags", nil, "list of tags to include or exclude (can specify multiple or separate values with commas: tag1,tag2,-tag3)")
5861
_ = c.BindPFlag("tags", flags.Lookup("tags"))
5962

63+
flags.Bool("raw", false, "print raw output without highlighting")
64+
_ = c.BindPFlag("raw", flags.Lookup("raw"))
65+
6066
return cmd
6167
}

cmd/actions/list.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package actions
22

33
import (
44
"context"
5+
"fmt"
56

67
"github.com/foomo/squadron"
78
"github.com/foomo/squadron/internal/config"
@@ -38,11 +39,14 @@ func NewList(c *viper.Viper) *cobra.Command {
3839
return value.Iterate(ctx, func(ctx context.Context, k string, v *config.Unit) error {
3940
list = append(list, pterm.LeveledListItem{Level: 1, Text: k})
4041
if c.GetBool("with-tags") && len(v.Tags) > 0 {
41-
list = append(list, pterm.LeveledListItem{Level: 2, Text: "🔖: " + v.Tags.SortedString()})
42+
list = append(list, pterm.LeveledListItem{Level: 2, Text: "🏷️: " + v.Tags.SortedString()})
4243
}
4344
if c.GetBool("with-charts") && len(v.Chart.String()) > 0 {
4445
list = append(list, pterm.LeveledListItem{Level: 2, Text: "📑: " + v.Chart.String()})
4546
}
47+
if c.GetBool("with-priority") && len(v.Chart.String()) > 0 {
48+
list = append(list, pterm.LeveledListItem{Level: 2, Text: fmt.Sprintf("☝️: %d", v.Priority)})
49+
}
4650
if c.GetBool("with-builds") && len(v.Builds) > 0 {
4751
for name, build := range v.Builds {
4852
list = append(list, pterm.LeveledListItem{Level: 2, Text: "📦: " + name})
@@ -76,6 +80,9 @@ func NewList(c *viper.Viper) *cobra.Command {
7680
flags.Bool("with-charts", false, "include charts")
7781
_ = c.BindPFlag("with-charts", flags.Lookup("with-charts"))
7882

83+
flags.Bool("with-priority", false, "include priority")
84+
_ = c.BindPFlag("with-priority", flags.Lookup("with-priority"))
85+
7986
flags.Bool("with-builds", false, "include builds")
8087
_ = c.BindPFlag("with-builds", flags.Lookup("with-builds"))
8188

cmd/actions/schema.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,24 @@ func NewSchema(c *viper.Viper) *cobra.Command {
2929
return errors.Wrap(err, "failed to filter config")
3030
}
3131

32-
js, err := sq.RenderSchema(cmd.Context(), c.GetString("base-schema"))
32+
out, err := sq.RenderSchema(cmd.Context(), c.GetString("base-schema"))
3333
if err != nil {
3434
return errors.Wrap(err, "failed to render schema")
3535
}
3636

3737
if output := c.GetString("output"); output != "" {
3838
pterm.Info.Printfln("Writing JSON schema to %s", output)
39-
if err := os.WriteFile(output, []byte(js), 0600); err != nil {
39+
if err := os.WriteFile(output, []byte(out), 0600); err != nil {
4040
return errors.Wrap(err, "failed to write schema")
4141
}
42-
} else {
43-
pterm.Println(util.Highlight(js))
42+
return nil
4443
}
4544

45+
if !c.GetBool("raw") {
46+
out = util.Highlight(out)
47+
}
48+
pterm.Println(out)
49+
4650
return nil
4751
},
4852
}
@@ -57,5 +61,8 @@ func NewSchema(c *viper.Viper) *cobra.Command {
5761
flags.StringSlice("tags", nil, "list of tags to include or exclude (can specify multiple or separate values with commas: tag1,tag2,-tag3)")
5862
_ = c.BindPFlag("tags", flags.Lookup("tags"))
5963

64+
flags.Bool("raw", false, "print raw output without highlighting")
65+
_ = c.BindPFlag("raw", flags.Lookup("raw"))
66+
6067
return cmd
6168
}

cmd/actions/template.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ func NewTemplate(c *viper.Viper) *cobra.Command {
4242
return errors.Wrap(err, "failed to render template")
4343
}
4444

45-
pterm.Println(util.Highlight(out))
45+
if !c.GetBool("raw") {
46+
out = util.Highlight(out)
47+
}
48+
pterm.Println(out)
4649

4750
return nil
4851
},
@@ -58,5 +61,8 @@ func NewTemplate(c *viper.Viper) *cobra.Command {
5861
flags.StringSlice("tags", nil, "list of tags to include or exclude (can specify multiple or separate values with commas: tag1,tag2,-tag3)")
5962
_ = c.BindPFlag("tags", flags.Lookup("tags"))
6063

64+
flags.Bool("raw", false, "print raw output without highlighting")
65+
_ = c.BindPFlag("raw", flags.Lookup("raw"))
66+
6167
return cmd
6268
}

0 commit comments

Comments
 (0)