Skip to content

Commit

Permalink
✨ Add update message
Browse files Browse the repository at this point in the history
  • Loading branch information
segersniels committed Nov 18, 2024
1 parent 788d92b commit 8d7a2da
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 16 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- uses: actions/setup-node@v4
with:
node-version: '20.x'
Expand All @@ -27,7 +25,6 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.54
working-directory: apps/cli

build:
Expand All @@ -37,8 +34,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- uses: actions/setup-node@v4
with:
node-version: '20.x'
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: build clean dev version demo $(TARGETS)

BINARY_NAME := genmoji
VERSION := 1.0.1
VERSION := 1.1.3
BUILD_DIR := bin

TARGETS := darwin-arm64 darwin-amd64 linux-arm64 linux-amd64
Expand Down
8 changes: 6 additions & 2 deletions apps/cli/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module segersniels/genmoji
module github.com/segersniels/genmoji

go 1.22.2
go 1.22.5

toolchain go1.23.2

require (
github.com/atotto/clipboard v0.1.4 // indirect
Expand All @@ -15,6 +17,7 @@ require (
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
Expand All @@ -27,6 +30,7 @@ require (
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sashabaranov/go-openai v1.24.0 // indirect
github.com/segersniels/config v0.0.0-20240503115636-403023c44d9f // indirect
github.com/segersniels/updater v1.2.1 // indirect
github.com/urfave/cli/v2 v2.27.1 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
Expand Down
6 changes: 6 additions & 0 deletions apps/cli/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHH
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA=
Expand Down Expand Up @@ -63,6 +65,10 @@ github.com/sashabaranov/go-openai v1.24.0 h1:4H4Pg8Bl2RH/YSnU8DYumZbuHnnkfioor/d
github.com/sashabaranov/go-openai v1.24.0/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
github.com/segersniels/config v0.0.0-20240503115636-403023c44d9f h1:Hryp2S1kBLyBv78hV2/YQPzwz5xYy0VsixFBqYNXfHc=
github.com/segersniels/config v0.0.0-20240503115636-403023c44d9f/go.mod h1:ZtYAvjzw4Y8B72nIjqWUnwYKeveEfiNbUilY/ts5MYE=
github.com/segersniels/updater v1.1.1 h1:PwAxWaPONXyoYQohU7kWhp+yn8gotjBPpD6G2PyN0qo=
github.com/segersniels/updater v1.1.1/go.mod h1:juYAsHmCiloHlG6YBrtRxoptQ3RZZswcktMtqQBQaBM=
github.com/segersniels/updater v1.2.1 h1:wruRuD2clGyisb+DpBdlNa+v3tTN668xTiu1dygQe+k=
github.com/segersniels/updater v1.2.1/go.mod h1:juYAsHmCiloHlG6YBrtRxoptQ3RZZswcktMtqQBQaBM=
github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho=
github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
Expand Down
24 changes: 16 additions & 8 deletions apps/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ import (

"github.com/charmbracelet/huh"
"github.com/segersniels/config"
updater "github.com/segersniels/updater"
"github.com/urfave/cli/v2"
)

var (
AppVersion string
AppName string
)

type Model string

const (
Expand All @@ -26,16 +32,16 @@ type ConfigData struct {
Model Model `json:"model"`
}

var (
AppVersion string
AppName string
CONFIG = config.NewConfig("genmoji", ConfigData{
Model: GPT4oMini,
})
)
var CONFIG = config.NewConfig("genmoji", ConfigData{
Model: GPT4oMini,
})

func main() {
genmoji := NewGenmoji()
upd := updater.NewUpdater(AppName, AppVersion, "segersniels")
version := upd.IsNewVersionAvailable()
if version != nil {
fmt.Printf("A new version of %s is available (%s).\n\n", AppName, version.String())
}

app := &cli.App{
Name: AppName,
Expand All @@ -46,6 +52,7 @@ func main() {
Name: "generate",
Usage: "Generate a commit message",
Action: func(ctx *cli.Context) error {
genmoji := NewGenmoji()
response, err := genmoji.Generate()
if err != nil {
return err
Expand All @@ -59,6 +66,7 @@ func main() {
Name: "commit",
Usage: "Generate a commit message and commit it",
Action: func(ctx *cli.Context) error {
genmoji := NewGenmoji()
return genmoji.Commit()
},
},
Expand Down

0 comments on commit 8d7a2da

Please sign in to comment.