builds
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/tag/woodpecker Pipeline failed

This commit is contained in:
abs3nt 2024-02-18 08:53:32 -08:00
parent 5573d5e864
commit 457be11274
Signed by: abs3nt
GPG Key ID: A7BD96A8BAB04C09
5 changed files with 118 additions and 9 deletions

61
.goreleaser.yaml Normal file
View File

@ -0,0 +1,61 @@
gitea_urls:
api: https://git.asdf.cafe/api/v1
download: https://git.asdf.cafe
skip_tls_verify: false
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
ignore:
- goos: windows
goarch: "386"
ldflags:
- -s -w -X git.asdf.cafe/abs3nt/gospt-ng/src.components.cli.Version={{.Version}}
archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
format_overrides:
- goos: windows
format: zip
files:
- completions/*
rlcp: true
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
groups:
- title: Added
regexp: '^.*?ADD(\([[:word:]]+\))??!?:.+$'
order: 0
- title: 'Bug fixes'
regexp: '^.*?BUG(\([[:word:]]+\))??!?:.+$'
order: 1
- title: 'Enhancements'
regexp: '^.*?IMPROVED(\([[:word:]]+\))??!?:.+$'
order: 1
- title: 'Docs'
regexp: '^.*?DOC(\([[:word:]]+\))??!?:.+$'
order: 1
- title: 'CI'
regexp: '^.*?CI(\([[:word:]]+\))??!?:.+$'
order: 1
- title: Others
order: 999

14
.woodpecker.yml Normal file
View File

@ -0,0 +1,14 @@
steps:
build:
image: golang:1.21
commands:
- go mod tidy
- go build -o gospt-ng
publish:
image: goreleaser/goreleaser
commands:
- goreleaser release --clean
secrets: [ gitea_token ]
when:
event: tag

24
Makefile Normal file
View File

@ -0,0 +1,24 @@
build: gospt-ng
gospt-ng: $(shell find . -name '*.go')
go build -o gospt-ng .
run:
go run main.go
tidy:
go mod tidy
clean:
rm -f gospt-ng
rm -rf completions
uninstall:
rm -f /usr/bin/gospt-ng
rm -f /usr/share/zsh/site-functions/_gospt-ng
rm -f /usr/share/bash-completion/completions/gospt-ng
rm -f /usr/share/fish/vendor_completions.d/gospt-ng.fish
install:
cp gospt-ng /usr/bin
cp ./completions/zsh_autocomplete /usr/share/zsh/site-functions/_gospt-ng

BIN
gospt-ng

Binary file not shown.

View File

@ -10,6 +10,8 @@ import (
"git.asdf.cafe/abs3nt/gospt-ng/src/components/commands"
)
var Version = "dev"
func Run(c *commands.Commander, s fx.Shutdowner) {
defer func() {
err := s.Shutdown()
@ -19,10 +21,11 @@ func Run(c *commands.Commander, s fx.Shutdowner) {
}()
app := &cli.App{
EnableBashCompletion: true,
Version: Version,
Commands: []*cli.Command{
{
Name: "play",
Aliases: []string{"p"},
Aliases: []string{"pl", "start", "s"},
Usage: "Plays spotify",
Action: func(cCtx *cli.Context) error {
return c.Play()
@ -46,49 +49,56 @@ func Run(c *commands.Commander, s fx.Shutdowner) {
},
{
Name: "link",
Aliases: []string{"l"},
Aliases: []string{"yy"},
Usage: "Prints the current song's spotify link",
Action: func(cCtx *cli.Context) error {
return c.PrintLink()
},
},
{
Name: "next",
Aliases: []string{"n"},
Aliases: []string{"n", "skip"},
Usage: "Skips to the next song",
Action: func(cCtx *cli.Context) error {
return c.Next()
},
},
{
Name: "previous",
Aliases: []string{"b"},
Aliases: []string{"b", "prev", "back"},
Usage: "Skips to the previous song",
Action: func(cCtx *cli.Context) error {
return c.Previous()
},
},
{
Name: "like",
Aliases: []string{"lk"},
Aliases: []string{"l"},
Usage: "Likes the current song",
Action: func(cCtx *cli.Context) error {
return c.Like()
},
},
{
Name: "unlike",
Aliases: []string{"ul"},
Aliases: []string{"u"},
Usage: "Unlikes the current song",
Action: func(cCtx *cli.Context) error {
return c.UnLike()
},
},
{
Name: "nowplaying",
Aliases: []string{"np"},
Aliases: []string{"now"},
Usage: "Prints the current song",
Action: func(cCtx *cli.Context) error {
return c.NowPlaying()
},
},
{
Name: "download_cover",
Aliases: []string{"dc"},
Usage: "Downloads the cover of the current song",
Aliases: []string{"dl"},
Args: true,
ArgsUsage: "download_cover <path>",
Action: func(cCtx *cli.Context) error {
@ -98,7 +108,7 @@ func Run(c *commands.Commander, s fx.Shutdowner) {
},
}
if err := app.Run(os.Args); err != nil {
slog.Error("COMMANDER", "uh oh", err)
slog.Error("COMMANDER", "run error", err)
os.Exit(1)
}
}