Skip to content

Commit

Permalink
Remove internal packages in favour of  'github.com/nikhilsbhat/common'.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilsbhat committed Jan 27, 2024
1 parent b6d8afc commit 3f2999e
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 280 deletions.
2 changes: 1 addition & 1 deletion cmd/pipelines.go
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ func showPipelineCommand() *cobra.Command {

var fileYAML Pipelines

object := render.Object(fileData)
object := content.Object(fileData)

switch objType := object.CheckFileType(cliLogger); objType {
case content.FileTypeYAML:
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@ module github.com/nikhilsbhat/gocd-cli
go 1.21.1

require (
github.com/ghodss/yaml v1.0.0
github.com/goccy/go-yaml v1.11.2
github.com/nikhilsbhat/common v0.0.3
github.com/nikhilsbhat/common v0.0.4-0.20240127094948-85c315a50de3
github.com/nikhilsbhat/gocd-sdk-go v0.1.9
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.6.1
github.com/stretchr/testify v1.8.4
github.com/thedevsaddam/gojsonq/v2 v2.5.2
github.com/thoas/go-funk v0.9.3
github.com/tidwall/gjson v1.16.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-resty/resty/v2 v2.11.0 // indirect
github.com/gocarina/gocsv v0.0.0-20231116093920-b87c2d0e983a // indirect
github.com/imdario/mergo v0.3.15 // indirect
Expand All @@ -40,4 +39,5 @@ require (
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/Qd
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/neilotoole/jsoncolor v0.7.1 h1:/MoU7KPLcto+ykcy592Y8eX9WFQhoi3IBEbwrP89dgs=
github.com/neilotoole/jsoncolor v0.7.1/go.mod h1:KZ9hUYN5xMrvyhqlFQ3QTmu11OcoqFgSnWAcYkN6abg=
github.com/nikhilsbhat/common v0.0.3 h1:HQ9aAxftmaCoTMOQVvXxwHZ5ehSf270BCND68JTwBEY=
github.com/nikhilsbhat/common v0.0.3/go.mod h1:ldoLjRsIaskDbouPaQ0ujVKbW8su3mI1MPQIaD24twQ=
github.com/nikhilsbhat/common v0.0.4-0.20240127094948-85c315a50de3 h1:NAQEpaBRA8K3FcAO5/Lw5jat6Ub/Ua64+njOaSYRqE8=
github.com/nikhilsbhat/common v0.0.4-0.20240127094948-85c315a50de3/go.mod h1:ldoLjRsIaskDbouPaQ0ujVKbW8su3mI1MPQIaD24twQ=
github.com/nikhilsbhat/gocd-sdk-go v0.1.9 h1:QG16EwKhxocn0Imza6S+/lE8S0MOw54UDebfJotQx2s=
github.com/nikhilsbhat/gocd-sdk-go v0.1.9/go.mod h1:FFVOLXPhn55evuuyfiRJ23R8I5Ks2n31/DXLBQmaNsw=
github.com/nwidger/jsoncolor v0.3.2 h1:rVJJlwAWDJShnbTYOQ5RM7yTA20INyKXlJ/fg4JMhHQ=
Expand Down
65 changes: 0 additions & 65 deletions pkg/render/object.go

This file was deleted.

78 changes: 0 additions & 78 deletions pkg/render/object_test.go

This file was deleted.

7 changes: 4 additions & 3 deletions pkg/render/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"strings"
"unicode"

"github.com/nikhilsbhat/common/content"
"github.com/thedevsaddam/gojsonq/v2"
)

Expand All @@ -26,13 +27,13 @@ type Query struct {

// SetQuery processes the data into a format FromString of gojsonq understands and return finally processed query.
func SetQuery(data interface{}, query string) (*Query, error) {
objectString, err := Marshal(data)
objectString, err := content.Marshal(data)
if err != nil {
return nil, err
}

queryObj := &Query{
JSONQ: objectString.getBaseQuery(),
JSONQ: getBaseQuery(objectString),
}

queryObj.ConstructQuery(query)
Expand Down Expand Up @@ -71,7 +72,7 @@ func (q *Query) ConstructQuery(query string) {
}
}

func (obj Object) getBaseQuery() *gojsonq.JSONQ {
func getBaseQuery(obj content.Object) *gojsonq.JSONQ {
return gojsonq.New().FromString(obj.String())
}

Expand Down
128 changes: 0 additions & 128 deletions pkg/render/render.go

This file was deleted.

0 comments on commit 3f2999e

Please sign in to comment.