diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..ff7d4de --- /dev/null +++ b/.goreleaser.yaml @@ -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 diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..b478f8f --- /dev/null +++ b/.woodpecker.yml @@ -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 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..98d02fa --- /dev/null +++ b/Makefile @@ -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 diff --git a/gospt-ng b/gospt-ng deleted file mode 100755 index b178bb3..0000000 Binary files a/gospt-ng and /dev/null differ diff --git a/src/components/cli/cli.go b/src/components/cli/cli.go index 1dd339c..ba497e0 100644 --- a/src/components/cli/cli.go +++ b/src/components/cli/cli.go @@ -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 ", 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) } }