8000 v1.0.0 commit by jftuga · Pull Request #1 · jftuga/DateTimeMate · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

v1.0.0 commit #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

8000
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
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
87 changes: 87 additions & 0 deletions .goreleaser.yml
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"
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/DateTimeMate.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions DateTimeMate.go
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
}
Loading
0