Skip to content

Commit

Permalink
add install methods (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddddddO authored Jun 24, 2023
1 parent 90e9a45 commit fc2a595
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
31 changes: 30 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,26 @@ before:
builds:
- main: ./cmd/calma/
binary: calma
ldflags:
- -s -w
- -X main.Version={{.Version}}
- -X main.Revision={{.ShortCommit}}
goos:
- linux
- darwin
- windows
env:
- CGO_ENABLED=0
- id: calma-linux
main: ./cmd/calma
binary: calma
ldflags:
- -s -w
- -X main.Version={{.Version}}
- -X main.Revision={{.ShortCommit}}
goos:
- linux
env:
- CGO_ENABLED=0
archives:
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
replacements:
Expand Down Expand Up @@ -47,3 +61,18 @@ scoop:
homepage: "https://github.com/ddddddO/calma"
description: "♻Calendar for Markdown♻ ...only for Japan!🎌"
license: "BSD-2-Clause"
nfpms:
- id: calma-nfpms
file_name_template: "{{ .ProjectName }}_{{ .Version }}-1_{{ .Arch }}"
builds:
- calma-linux
homepage: https://github.com/ddddddO/calma
maintainer: ddddddO <lbfdeatq@gmail.com>
description: "Calendar for Markdown ...only for Japan!"
license: BSD-2-Clause
formats:
- deb
- rpm
- apk
bindir: /usr/bin
epoch: 1
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,26 @@ $ scoop bucket add ddddddO https://github.com/ddddddO/scoop-bucket.git
$ scoop install ddddddO/calma
```

### deb
```console
$ export CALMA_VERSION=X.X.X
$ curl -o calma.deb -L https://github.com/ddddddO/calma/releases/download/v$CALMA_VERSION/calma_$CALMA_VERSION-1_amd64.deb
$ dpkg -i calma.deb
```

### rpm
```console
$ export CALMA_VERSION=X.X.X
$ yum install https://github.com/ddddddO/calma/releases/download/v$CALMA_VERSION/calma_$CALMA_VERSION-1_amd64.rpm
```

### apk
```console
$ export CALMA_VERSION=X.X.X
$ curl -o calma.apk -L https://github.com/ddddddO/calma/releases/download/v$CALMA_VERSION/calma_$CALMA_VERSION-1_amd64.apk
$ apk add --allow-untrusted calma.apk
```

### etc

**download binary from [here](https://github.com/ddddddO/calma/releases).**
Expand Down
13 changes: 13 additions & 0 deletions cmd/calma/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import (

var jst = time.FixedZone("JST", +9*60*60)

var (
Version = "unset"
Revision = "unset"
)

func main() {
flag.Usage = func() {
usage := "This CLI outputs Japanese calendar in Markdown. It supports national holidays.\n\nUsage of %s:\n"
Expand All @@ -24,8 +29,16 @@ func main() {
flag.IntVar(&advance, "a", 0, "Number of months to advance")
var isHTML bool
flag.BoolVar(&isHTML, "html", false, "Output html")
var isVersion bool
flag.BoolVar(&isVersion, "version", false, "Show the version")

flag.Parse()

if isVersion {
fmt.Printf("calma version %s / revision %s\n", Version, Revision)
os.Exit(0)
}

if retreat != 0 && advance != 0 {
fmt.Fprintln(os.Stderr, xerrors.New("Please use either"))
os.Exit(1)
Expand Down

0 comments on commit fc2a595

Please sign in to comment.