Skip to content

Commit

Permalink
Added initial goreleaser files.
Browse files Browse the repository at this point in the history
  • Loading branch information
BogdanHabic committed Nov 8, 2018
1 parent 726d781 commit 59d6521
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
dist/*
build/*
18 changes: 18 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
builds:
- env:
- CGO_ENABLED=0
archive:
replacements:
darwin: Darwin
linux: Linux
windows: Windows
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
9 changes: 9 additions & 0 deletions commands.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"fmt"
"github.com/spf13/cobra"
"github.com/tenderly/tenderly-cli/cmd/proxy"
)
Expand All @@ -23,6 +24,7 @@ func init() {
proxyCmd.PersistentFlags().StringVar(&network, "network", "", "Network id.")

rootCmd.AddCommand(proxyCmd)
rootCmd.AddCommand(versionCmd)
}

var rootCmd = &cobra.Command{
Expand All @@ -31,6 +33,13 @@ var rootCmd = &cobra.Command{
Long: "Tenderly is a development tool for smart contract.",
}

var versionCmd = &cobra.Command{
Use: "version",
Short: "Shows the version of the cli",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("Current CLI version: %s", CurrentCLIVersion)
},
}
var proxyCmd = &cobra.Command{
Use: "proxy",
Short: "Proxy",
Expand Down
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ import (
"os"
)

var (
version = ""
)

var CurrentCLIVersion string

func Execute() {
CurrentCLIVersion = version
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(0)
Expand Down

0 comments on commit 59d6521

Please sign in to comment.