Skip to content

Commit 67b8a84

Browse files
committed
Add version information
1 parent c74c8f5 commit 67b8a84

File tree

5 files changed

+61
-3
lines changed

5 files changed

+61
-3
lines changed

.goreleaser.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ builds:
1010
- linux
1111
- windows
1212
- darwin
13+
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.buildTime={{.Date}}`.
1314

1415
archives:
1516
- format: tar.gz
@@ -42,8 +43,8 @@ brews:
4243
homepage: https://github.com/meap/runecs
4344
tap:
4445
owner: meap
45-
name: homebrew
46+
name: homebrew-runecs
4647
commit_author:
4748
name: meap
4849
49-
50+

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ RunECS is a tool for executing one-off processes in an ECS cluster.
77
* Only FARGATE launch type is supported.
88
* Sidecar containers are not supported
99

10+
# Install
11+
12+
## Manual
13+
14+
Download the binary file for your platform, [see releases](https://github.com/meap/runecs/releases).
15+
16+
## Homebrew
17+
18+
```shell
19+
brew tap meap/runecs
20+
brew install runecs
21+
```
1022

1123
# How to Use
1224

cmd/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ import (
2929
var rootCmd = &cobra.Command{}
3030

3131
func init() {
32-
rootCmd.PersistentFlags().String("service", "", "service name (cluster/service)")
3332
rootCmd.CompletionOptions.DisableDefaultCmd = true
33+
rootCmd.PersistentFlags().String("service", "", "service name (cluster/service)")
3434
viper.BindPFlag("service", rootCmd.PersistentFlags().Lookup("service"))
3535

3636
var dockerImageTag string

cmd/version.go

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/spf13/cobra"
7+
)
8+
9+
type Version struct {
10+
Version string
11+
Commit string
12+
BuildTime string
13+
}
14+
15+
var version *Version
16+
17+
var versionCmd = &cobra.Command{
18+
Use: "version",
19+
Short: "print the version number and exit",
20+
Run: printVersion,
21+
}
22+
23+
func init() {
24+
rootCmd.AddCommand(versionCmd)
25+
}
26+
27+
func printVersion(cmd *cobra.Command, args []string) {
28+
fmt.Printf("runecs %s\n", version.Version)
29+
}
30+
31+
func SetVersion(v *Version) {
32+
version = v
33+
}

main.go

+12
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ package main
1616

1717
import "runecs.io/v1/cmd"
1818

19+
var (
20+
version = "No version provided"
21+
commit = "No commit provided"
22+
buildTime = "No build timestamp provided"
23+
)
24+
1925
func main() {
26+
cmd.SetVersion(&cmd.Version{
27+
Version: version,
28+
Commit: commit,
29+
BuildTime: buildTime,
30+
})
31+
2032
cmd.Execute()
2133
}

0 commit comments

Comments
 (0)