diff --git a/.gitignore b/.gitignore index 496ee2c..c3c5eb9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.DS_Store \ No newline at end of file +.DS_Store +dist/ \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index cb26e83..557bb15 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -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 diff --git a/README.md b/README.md index 53a00b4..fdf0659 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/dist/config.yaml b/dist/config.yaml deleted file mode 100644 index 7d04d32..0000000 --- a/dist/config.yaml +++ /dev/null @@ -1,113 +0,0 @@ -project_name: amtui -release: - github: - owner: pehlicd - name: amtui - name_template: '{{.Tag}}' -builds: - - id: amtui - goos: - - linux - - darwin - - windows - goarch: - - amd64 - - arm64 - goarm: - - "6" - gomips: - - hardfloat - goamd64: - - v1 - targets: - - linux_amd64_v1 - - linux_arm64 - - darwin_amd64_v1 - - darwin_arm64 - - windows_amd64_v1 - ignore: - - goos: windows - goarch: arm64 - dir: . - main: . - binary: amtui - builder: go - gobinary: go - command: build - ldflags: - - -s -w -X pkg.versionString={{ .Tag } - env: - - CGO_ENABLED=0 -archives: - - id: default - builds: - - amtui - name_template: '{{ .ProjectName }}_{{ .Tag }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' - format: tar.gz - wrap_in_directory: "false" - files: - - src: LICENSE -snapshot: - name_template: '{{ .Version }}-SNAPSHOT-{{ .ShortCommit }}' -checksum: - name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt' - algorithm: sha256 -dist: dist -env_files: - github_token: ~/.config/goreleaser/github_token - gitlab_token: ~/.config/goreleaser/gitlab_token - gitea_token: ~/.config/goreleaser/gitea_token -before: - hooks: - - go mod download -source: - name_template: '{{ .ProjectName }}-{{ .Version }}' - format: tar.gz -gomod: - gobinary: go -announce: - twitter: - message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}' - mastodon: - message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}' - server: "" - reddit: - title_template: '{{ .ProjectName }} {{ .Tag }} is out!' - url_template: '{{ .ReleaseURL }}' - slack: - message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}' - username: GoReleaser - discord: - message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}' - author: GoReleaser - color: "3888754" - icon_url: https://goreleaser.com/static/avatar.png - teams: - title_template: '{{ .ProjectName }} {{ .Tag }} is out!' - message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}' - color: '#2D313E' - icon_url: https://goreleaser.com/static/avatar.png - smtp: - subject_template: '{{ .ProjectName }} {{ .Tag }} is out!' - body_template: 'You can view details from: {{ .ReleaseURL }}' - mattermost: - message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}' - title_template: '{{ .ProjectName }} {{ .Tag }} is out!' - username: GoReleaser - linkedin: - message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}' - telegram: - message_template: '{{ .ProjectName }} {{ mdv2escape .Tag }} is out! Check it out at {{ mdv2escape .ReleaseURL }}' - parse_mode: MarkdownV2 - webhook: - message_template: '{ "message": "{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}"}' - content_type: application/json; charset=utf-8 - opencollective: - title_template: '{{ .Tag }}' - message_template: '{{ .ProjectName }} {{ .Tag }} is out!
Check it out at {{ .ReleaseURL }}' -git: - tag_sort: -version:refname -github_urls: - download: https://github.com -gitlab_urls: - download: https://gitlab.com diff --git a/pkg/config.go b/pkg/config.go index 089214f..8eaabca 100644 --- a/pkg/config.go +++ b/pkg/config.go @@ -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) { @@ -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) }