Skip to content

Commit

Permalink
Merge pull request #30 from noborus/version-flags
Browse files Browse the repository at this point in the history
Add version and help flag using cobra
  • Loading branch information
noborus authored Feb 27, 2024
2 parents 64ab5b6 + d7e4bf1 commit e2864d3
Show file tree
Hide file tree
Showing 6 changed files with 273 additions and 93 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
vendor/
mdviewer
80 changes: 80 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
before:
hooks:
- go mod tidy
- go mod vendor
builds:
-
id: mdviewer-linux
binary: mdviewer
ldflags:
- -X main.Version={{.Version}}
- -X main.Revision={{.ShortCommit}}
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
- arm
- arm64
-
id: mdviewer-other
binary: mdviewer
ldflags:
- -X main.Version={{.Version}}
- -X main.Revision={{.ShortCommit}}
env:
- CGO_ENABLED=0
goos:
- darwin
- windows
- freebsd
goarch:
- '386'
- amd64
- arm
- arm64

archives:
-
id: mdviewer-archives
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
builds:
- mdviewer-linux
- mdviewer-other
files:
- LICENSE
- README.md
format: zip

nfpms:
-
id: mdviewer-nfpms
file_name_template: "{{ .ProjectName }}_{{ .Version }}-1_{{ .Arch }}"
builds:
- mdviewer-linux
homepage: https://github.com/noborus/mdviewer
maintainer: Noboru Saito <[email protected]>
description: "markdown viewer"
license: MIT
formats:
- deb
- rpm
bindir: /usr/bin

brews:
-
name: mdviewer
repository:
owner: noborus
name: homebrew-tap
token: "{{ .Env.TAP_GITHUB_TOKEN }}"
commit_author:
name: noborus
email: [email protected]
homepage: https://github.com/noborus/mdviewer
description: "markdown viewer"
test:
system "#{bin}/mdviewer --version"
install:
bin.install "mdviewer"
33 changes: 19 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
module github.com/noborus/mdviewer

go 1.19
go 1.21

toolchain go1.22.0

require (
github.com/charmbracelet/glamour v0.6.0
github.com/noborus/ov v0.33.2
github.com/noborus/ov v0.33.3
github.com/spf13/cobra v1.8.0
)

require (
Expand All @@ -14,35 +17,37 @@ require (
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dlclark/regexp2 v1.10.0 // indirect
github.com/dlclark/regexp2 v1.11.0 // indirect
github.com/frankban/quicktest v1.14.6 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gdamore/encoding v1.0.0 // indirect
github.com/gdamore/tcell/v2 v2.7.0 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/gdamore/tcell/v2 v2.7.1 // indirect
github.com/gorilla/css v1.0.1 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jwalton/gchalk v1.3.0 // indirect
github.com/jwalton/go-supportscolor v1.2.0 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/microcosm-cc/bluemonday v1.0.25 // indirect
github.com/microcosm-cc/bluemonday v1.0.26 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/noborus/guesswidth v0.3.4 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/yuin/goldmark v1.5.6 // indirect
github.com/yuin/goldmark v1.7.0 // indirect
github.com/yuin/goldmark-emoji v1.0.2 // indirect
golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
)
Loading

0 comments on commit e2864d3

Please sign in to comment.