Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
BINARY=epcc
VERSION=NIGHTLY

build:
go build -o ./bin/${BINARY} ./cmd/
go build -o ./bin/${BINARY} ./

release-some:
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ./bin/${VERSION}/darwin_amd64/${BINARY}
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o ./bin/${VERSION}/darwin_arm64/${BINARY}
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ./bin/${VERSION}/windows_amd64/${BINARY}.exe
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./bin/${VERSION}/linux_amd64/${BINARY}


release: release-some
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -o ./bin/${VERSION}/windows_386/${BINARY}.exe
CGO_ENABLED=0 GOOS=freebsd GOARCH=386 go build -o ./bin/${VERSION}/freebsd_386/${BINARY}
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -o ./bin/${VERSION}/freebsd_amd64/${BINARY}
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm go build -o ./bin/${VERSION}/freebsd_arm/${BINARY}
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -o ./bin/${VERSION}/linux_386/${BINARY}
CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -o ./bin/${VERSION}/linux_arm/${BINARY}
CGO_ENABLED=0 GOOS=openbsd GOARCH=386 go build -o ./bin/${VERSION}/openbsd_386/${BINARY}
CGO_ENABLED=0 GOOS=openbsd GOARCH=amd64 go build -o ./bin/${VERSION}/openbsd_amd64/${BINARY}
CGO_ENABLED=0 GOOS=solaris GOARCH=amd64 go build -o ./bin/${VERSION}/solaris_amd64/${BINARY}

clean:
rm -rf bin || true
3 changes: 3 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"github.com/caarlos0/env/v6"
"github.com/elasticpath/epcc-cli/config"
"github.com/elasticpath/epcc-cli/external/json"
homedir "github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand All @@ -26,6 +27,8 @@ func init() {
get,
)

testJson.Flags().BoolVarP(&noWrapping, "no-wrapping", "", false, "if set, we won't wrap the output the json in a data tag")
rootCmd.PersistentFlags().BoolVarP(&json.MonochromeOutput, "monochrome-output", "M", false, "By default, epcc will output using colors if the terminal supports this. Use this option to disable it.")
}

var rootCmd = &cobra.Command{
Expand Down
7 changes: 4 additions & 3 deletions cmd/test-json.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package cmd

import (
"fmt"
"github.com/elasticpath/epcc-cli/external/json"
"github.com/spf13/cobra"
)

var noWrapping bool
var testJson = &cobra.Command{
Use: "test-json [KEY_1] [VAL_1] [KEY_2] [VAL_2] ...",
Short: "Prints the resulting json for what a command will look like",
RunE: func(cmd *cobra.Command, args []string) error {
res, err := json.ToJson(args)
res, err := json.ToJson(args, noWrapping)

if res != "" {
fmt.Println(res)
json.PrintJson(res)

}
return err

Expand Down
Loading