Skip to content

Commit

Permalink
Merge pull request #34 from WanderaOrg/defaulting
Browse files Browse the repository at this point in the history
Fix of config defaulting
  • Loading branch information
coufalja authored Aug 14, 2019
2 parents 1c91f86 + 434a465 commit 351160a
Show file tree
Hide file tree
Showing 14 changed files with 189 additions and 153 deletions.
2 changes: 1 addition & 1 deletion cmd/decrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var decryptCmd = &cobra.Command{
},
}

//ExecuteDecrypt runs decrypt cmd
// ExecuteDecrypt runs decrypt cmd
func ExecuteDecrypt() error {
if dp.value == "" {
bytes, err := ioutil.ReadAll(os.Stdin)
Expand Down
2 changes: 1 addition & 1 deletion cmd/decrypt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ func ExampleExecuteDecrypt() {
dp.source = ts.URL
dp.value = tp.testContent
ExecuteDecrypt()
//Output: test
// Output: test
}
4 changes: 2 additions & 2 deletions cmd/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func validateDiffParams(cmd *cobra.Command, args []string) error {
return nil
}

//ExecuteDiffValues runs diff values cmd
// ExecuteDiffValues runs diff values cmd
func ExecuteDiffValues() error {
ext, err := client.ParseExtension(diffp.format)

Expand Down Expand Up @@ -96,7 +96,7 @@ func ExecuteDiffValues() error {
return difflib.WriteUnifiedDiff(os.Stdout, d)
}

//ExecuteDiffFiles runs diff files cmd
// ExecuteDiffFiles runs diff files cmd
func ExecuteDiffFiles() error {
errorHandler := func(data []byte, err error) []byte {
if e, ok := err.(client.HTTPError); ok && e.StatusCode() == http.StatusNotFound {
Expand Down
2 changes: 1 addition & 1 deletion cmd/encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var encryptCmd = &cobra.Command{
},
}

//ExecuteEncrypt runs encrypt cmd
// ExecuteEncrypt runs encrypt cmd
func ExecuteEncrypt() error {
if ep.value == "" {
bytes, err := ioutil.ReadAll(os.Stdin)
Expand Down
2 changes: 1 addition & 1 deletion cmd/encrypt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ func ExampleExecuteEncrypt() {
ep.source = ts.URL
ep.value = tp.testContent
ExecuteEncrypt()
//Output: test
// Output: test
}
14 changes: 7 additions & 7 deletions cmd/filemapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (
const mappingSeparator = ","
const sourceDestSeparator = ":"

//FileMapping single file mapping source:dest
// FileMapping single file mapping source:dest
type FileMapping struct {
source string
destination string
}

//FileMappings file mappings source:dest,source:dest...
// FileMappings file mappings source:dest,source:dest...
type FileMappings struct {
mappings []FileMapping
}
Expand All @@ -23,7 +23,7 @@ func (m *FileMappings) String() string {
return ""
}

//Set parse mappings from string
// Set parse mappings from string
func (m *FileMappings) Set(value string) error {
mappings := strings.Split(value, mappingSeparator)

Expand All @@ -41,17 +41,17 @@ func (m *FileMappings) Set(value string) error {
return nil
}

//Type type name (for cobra)
// Type type name (for cobra)
func (m *FileMappings) Type() string {
return "FileMappings"
}

//Mappings all mappings
// Mappings all mappings
func (m *FileMappings) Mappings() []FileMapping {
return m.mappings
}

//Sources all sources
// Sources all sources
func (m *FileMappings) Sources() []string {
sources := make([]string, len(m.mappings))
for i, mapping := range m.mappings {
Expand All @@ -61,7 +61,7 @@ func (m *FileMappings) Sources() []string {
return sources
}

//Destinations all destinations
// Destinations all destinations
func (m *FileMappings) Destinations() []string {
destinations := make([]string, len(m.mappings))
for i, mapping := range m.mappings {
Expand Down
4 changes: 2 additions & 2 deletions cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var getFilesCmd = &cobra.Command{
},
}

//ExecuteGetValues runs get values cmd
// ExecuteGetValues runs get values cmd
func ExecuteGetValues() error {
ext, err := client.ParseExtension(gp.format)

Expand Down Expand Up @@ -75,7 +75,7 @@ func ExecuteGetValues() error {
return nil
}

//ExecuteGetFiles runs get files cmd
// ExecuteGetFiles runs get files cmd
func ExecuteGetFiles() error {
for _, mapping := range gp.fileMappings.Mappings() {
resp, err := client.
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func init() {
rootCmd.AddCommand(versionCmd)
}

//Execute run root command (main entrypoint)
// Execute run root command (main entrypoint)
func Execute() error {
return rootCmd.Execute()
}
43 changes: 10 additions & 33 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,49 +1,26 @@
module github.com/WanderaOrg/scccmd

require (
github.com/PuerkitoBio/purell v1.1.0 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/cpuguy83/go-md2man v1.0.8 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dimiro1/health v0.0.0-20170102175817-22672c488556
github.com/emicklei/go-restful v2.6.0+incompatible // indirect
github.com/fsnotify/fsnotify v1.4.7 // indirect
github.com/ghodss/yaml v1.0.0
github.com/go-openapi/jsonpointer v0.0.0-20180322222829-3a0015ad55fa // indirect
github.com/go-openapi/jsonreference v0.0.0-20180322222742-3fb327e6747d // indirect
github.com/go-openapi/spec v0.0.0-20180326232708-9acd88844bc1 // indirect
github.com/go-openapi/swag v0.0.0-20180302192843-ceb469cb0fdf // indirect
github.com/gogo/protobuf v1.0.0 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/golang/protobuf v1.2.0 // indirect
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf // indirect
github.com/golang/protobuf v1.3.2 // indirect
github.com/google/go-cmp v0.3.1 // indirect
github.com/howeyc/fsnotify v0.9.0
github.com/hpcloud/tail v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/json-iterator/go v0.0.0-20180315132816-ca39e5af3ece // indirect
github.com/mailru/easyjson v0.0.0-20180323154445-8b799c424f57 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v0.0.0-20180228065516-1df9eeb2bb81 // indirect
github.com/onsi/ginkgo v1.6.0 // indirect
github.com/onsi/gomega v1.3.0
github.com/onsi/gomega v1.5.0
github.com/pmezard/go-difflib v1.0.0
github.com/russross/blackfriday v1.5.1 // indirect
github.com/sirupsen/logrus v1.0.6
github.com/spf13/cobra v0.0.2
github.com/spf13/pflag v1.0.0 // indirect
github.com/stretchr/testify v1.2.2 // indirect
golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb // indirect
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect
golang.org/x/sys v0.0.0-20180715085529-ac767d655b30 // indirect
golang.org/x/text v0.3.0 // indirect
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 // indirect
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // indirect
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
gopkg.in/inf.v0 v0.9.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/resty.v1 v1.11.0
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.1.1
k8s.io/api v0.0.0-20180103015100-006a217681ae
k8s.io/apimachinery v0.0.0-20180103014849-68f9c3a1feb3
k8s.io/kube-openapi v0.0.0-20180216212618-50ae88d24ede // indirect
gopkg.in/yaml.v2 v2.2.2
k8s.io/api v0.0.0-20190813220812-4c9d9526570f
k8s.io/apimachinery v0.0.0-20190813235223-d2c4b5819cd0
)
Loading

0 comments on commit 351160a

Please sign in to comment.