-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
1,672 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
name: GoReleaser Build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set Up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.x" | ||
id: go | ||
|
||
- name: run GoReleaser | ||
uses: goreleaser/goreleaser-action@v6 | ||
env: | ||
HOMEBREW_TOKEN: ${{ secrets.HOMEBREW_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
args: release --clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
version: 2 | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
- id: dtmate | ||
binary: dtmate | ||
dir: ./cmd/dtmate | ||
ldflags: | ||
- -extldflags "-static" -s -w -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser -X main.Version={{.Version}} -X main.Revision={{.ShortCommit}} | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- freebsd | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
- arm | ||
- ppc64le | ||
goarm: | ||
- "7" | ||
ignore: | ||
- goos: freebsd | ||
goarch: arm64 | ||
- goos: freebsd | ||
goarch: arm | ||
- goos: freebsd | ||
goarch: ppc64le | ||
- goos: darwin | ||
goarch: arm | ||
- goos: darwin | ||
goarch: ppc64le | ||
|
||
- id: dtmate-win | ||
binary: dtmate | ||
dir: ./cmd/dtmate | ||
ldflags: | ||
- -extldflags "-static" -s -w -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser -X main.Version={{.Version}} -X main.Revision={{.ShortCommit}} | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- windows | ||
goarch: | ||
- amd64 | ||
hooks: | ||
post: | ||
- upx -9 "{{ .Path }}" | ||
|
||
archives: | ||
- name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" | ||
format: tar.xz | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
wrap_in_directory: true | ||
files: | ||
- LICENSE | ||
- README.md | ||
|
||
checksum: | ||
name_template: "{{ .ProjectName }}_{{ .Version }}--checksums.txt" | ||
release: | ||
draft: false | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- "^docs:" | ||
- "^test:" | ||
|
||
brews: | ||
- name: dtmate | ||
repository: | ||
owner: jftuga | ||
name: homebrew-tap | ||
token: "{{ .Env.HOMEBREW_TOKEN }}" | ||
commit_author: | ||
name: jftuga | ||
email: jftuga@users.noreply.github.com | ||
homepage: https://github.com/jftuga/DateTimeMate | ||
description: "dtmate: output the difference between date, time or duration" | ||
test: system "#{bin}/dtmate -v" | ||
install: bin.install "dtmate" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package DateTimeMate | ||
|
||
import ( | ||
"github.com/golang-module/carbon/v2" | ||
"strings" | ||
) | ||
|
||
const ( | ||
ModName string = "DateTimeMate" | ||
ModVersion string = "1.0.0" | ||
ModUrl string = "https://github.com/jftuga/DateTimeMate" | ||
) | ||
|
||
// convertRelativeDateToActual converts "yesterday", "today", "tomorrow" | ||
// into actual dates; yesterday and tomorrow are -/+ 24 hours of current time | ||
func convertRelativeDateToActual(from string) string { | ||
switch strings.ToLower(from) { | ||
case "now": | ||
return carbon.Now().String() | ||
case "today": | ||
return carbon.Now().String() | ||
case "yesterday": | ||
return carbon.Yesterday().String() | ||
case "tomorrow": | ||
return carbon.Tomorrow().String() | ||
} | ||
return from | ||
} |
Oops, something went wrong.