Skip to content

Commit

Permalink
Update readme and better version output.
Browse files Browse the repository at this point in the history
  • Loading branch information
pehlicd committed Sep 10, 2023
1 parent 2ce9354 commit 99373a3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 126 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
.DS_Store
dist/
3 changes: 1 addition & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ builds:
binary: amtui
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X pkg.versionString={{ .Tag }
ldflags: -s -w -X pkg.versionString={{.Version}} -X pkg.commit={{.Commit}} -X pkg.date={{.Date}}
goos:
- linux
- darwin
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ AMTUI uses a configuration file to connect to your Alertmanager instance. By def
You can also specify connection details using command-line flags:

```bash
amtui --host 127.0.0.1 --port 9093 --scheme http
amtui --host 127.0.0.1 --port 9093 --insecure
```

## Dependencies
Expand Down
113 changes: 0 additions & 113 deletions dist/config.yaml

This file was deleted.

20 changes: 11 additions & 9 deletions pkg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ Options:
-v, --version Show version
-h, --help Help
`
versionString
)

var (
fl = flag.NewFlagSet("amtui", flag.ExitOnError)
host = fl.String("host", "localhost", "Alertmanager host")
port = fl.StringP("port", "p", "9093", "Alertmanager port")
insecure = fl.BoolP("insecure", "i", true, "For insecurely connecting to Alertmanager")
help = fl.BoolP("help", "h", false, "Show help")
version = fl.BoolP("version", "v", false, "Show version")
scheme = "http"
versionString string
date string
commit string
fl = flag.NewFlagSet("amtui", flag.ExitOnError)
host = fl.String("host", "localhost", "Alertmanager host")
port = fl.StringP("port", "p", "9093", "Alertmanager port")
insecure = fl.BoolP("insecure", "i", true, "For insecurely connecting to Alertmanager")
help = fl.BoolP("help", "h", false, "Show help")
version = fl.BoolP("version", "v", false, "Show version")
scheme = "http"
)

func printHelp(w io.Writer) {
Expand Down Expand Up @@ -77,7 +79,7 @@ func initConfig() Config {
}

if *version {
fmt.Printf("amtui version: %s\n", versionString)
fmt.Printf("amtui version: v%s\nReleased at: %s\nCommit: %s\n", versionString, date, commit)
os.Exit(0)
}

Expand Down

0 comments on commit 99373a3

Please sign in to comment.