This commit is contained in:
parent
8e067ac28d
commit
59fff8dfef
82
.golangci.yml
Normal file
82
.golangci.yml
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
linters:
|
||||||
|
disable-all: true
|
||||||
|
enable:
|
||||||
|
- gofmt
|
||||||
|
- errcheck
|
||||||
|
- gosimple
|
||||||
|
- govet
|
||||||
|
- ineffassign
|
||||||
|
- staticcheck
|
||||||
|
- gocritic
|
||||||
|
- bodyclose
|
||||||
|
- gosec
|
||||||
|
- prealloc
|
||||||
|
- unconvert
|
||||||
|
- unused
|
||||||
|
|
||||||
|
linters-settings:
|
||||||
|
gocritic:
|
||||||
|
# Which checks should be enabled; can't be combined with 'disabled-checks';
|
||||||
|
# See https://go-critic.github.io/overview#checks-overview
|
||||||
|
# To check which checks are enabled run `GL_DEBUG=gocritic ./build/bin/golangci-lint run`
|
||||||
|
# By default list of stable checks is used.
|
||||||
|
enabled-checks:
|
||||||
|
- ruleguard
|
||||||
|
- truncateCmp
|
||||||
|
|
||||||
|
# Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty
|
||||||
|
disabled-checks:
|
||||||
|
- captLocal
|
||||||
|
- assignOp
|
||||||
|
- paramTypeCombine
|
||||||
|
- importShadow
|
||||||
|
- commentFormatting
|
||||||
|
|
||||||
|
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
|
||||||
|
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
|
||||||
|
enabled-tags:
|
||||||
|
- performance
|
||||||
|
- diagnostic
|
||||||
|
- opinionated
|
||||||
|
disabled-tags:
|
||||||
|
- experimental
|
||||||
|
settings:
|
||||||
|
hugeParam:
|
||||||
|
# size in bytes that makes the warning trigger (default 80)
|
||||||
|
sizeThreshold: 1000
|
||||||
|
rangeValCopy:
|
||||||
|
sizeThreshold: 1024
|
||||||
|
rangeExprCopy:
|
||||||
|
# size in bytes that makes the warning trigger (default 512)
|
||||||
|
sizeThreshold: 512
|
||||||
|
# whether to check test functions (default true)
|
||||||
|
skipTestFuncs: true
|
||||||
|
truncateCmp:
|
||||||
|
# whether to skip int/uint/uintptr types (default true)
|
||||||
|
skipArchDependent: true
|
||||||
|
underef:
|
||||||
|
# whether to skip (*x).method() calls where x is a pointer receiver (default true)
|
||||||
|
skipRecvDeref: true
|
||||||
|
|
||||||
|
govet:
|
||||||
|
disable:
|
||||||
|
- deepequalerrors
|
||||||
|
- fieldalignment
|
||||||
|
- shadow
|
||||||
|
- unsafeptr
|
||||||
|
goconst:
|
||||||
|
min-len: 2
|
||||||
|
min-occurrences: 2
|
||||||
|
|
||||||
|
issues:
|
||||||
|
exclude-rules:
|
||||||
|
- linters:
|
||||||
|
- golint
|
||||||
|
text: "should be"
|
||||||
|
- linters:
|
||||||
|
- errcheck
|
||||||
|
text: "not checked"
|
||||||
|
- linters:
|
||||||
|
- staticcheck
|
||||||
|
text: "SA(1019|1029|5011)"
|
||||||
|
|
@ -16,12 +16,6 @@ import (
|
|||||||
var Version = "dev"
|
var Version = "dev"
|
||||||
|
|
||||||
func Run(c *commands.Commander, s fx.Shutdowner) {
|
func Run(c *commands.Commander, s fx.Shutdowner) {
|
||||||
defer func() {
|
|
||||||
err := s.Shutdown()
|
|
||||||
if err != nil {
|
|
||||||
c.Log.Error("SHUTDOWN", "error shutting down", err)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
app := &cli.App{
|
app := &cli.App{
|
||||||
Name: "gspot",
|
Name: "gspot",
|
||||||
EnableBashCompletion: true,
|
EnableBashCompletion: true,
|
||||||
@ -347,6 +341,7 @@ func Run(c *commands.Commander, s fx.Shutdowner) {
|
|||||||
}
|
}
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
c.Log.Error("COMMANDER", "run error", err)
|
c.Log.Error("COMMANDER", "run error", err)
|
||||||
os.Exit(1)
|
s.Shutdown(fx.ExitCode(1))
|
||||||
}
|
}
|
||||||
|
s.Shutdown()
|
||||||
}
|
}
|
||||||
|
@ -267,34 +267,34 @@ func (m *mainModel) CopyToClipboard() error {
|
|||||||
switch converted := item.(type) {
|
switch converted := item.(type) {
|
||||||
case spotify.SimplePlaylist:
|
case spotify.SimplePlaylist:
|
||||||
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
||||||
clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
return clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
||||||
case *spotify.FullPlaylist:
|
case *spotify.FullPlaylist:
|
||||||
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
||||||
clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
return clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
||||||
case spotify.SimpleAlbum:
|
case spotify.SimpleAlbum:
|
||||||
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
||||||
clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
return clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
||||||
case *spotify.FullAlbum:
|
case *spotify.FullAlbum:
|
||||||
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
||||||
clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
return clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
||||||
case spotify.SimpleArtist:
|
case spotify.SimpleArtist:
|
||||||
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
||||||
clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
return clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
||||||
case *spotify.FullArtist:
|
case *spotify.FullArtist:
|
||||||
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
||||||
clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
return clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
||||||
case spotify.SimpleTrack:
|
case spotify.SimpleTrack:
|
||||||
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
||||||
clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
return clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
||||||
case spotify.PlaylistTrack:
|
case spotify.PlaylistTrack:
|
||||||
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
||||||
clipboard.WriteAll(converted.Track.ExternalURLs["spotify"])
|
return clipboard.WriteAll(converted.Track.ExternalURLs["spotify"])
|
||||||
case spotify.SavedTrack:
|
case spotify.SavedTrack:
|
||||||
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
||||||
clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
return clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
||||||
case spotify.FullTrack:
|
case spotify.FullTrack:
|
||||||
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
go m.SendMessage("Copying link to "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
|
||||||
clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
return clipboard.WriteAll(converted.ExternalURLs["spotify"])
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -746,7 +746,7 @@ func (m *mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
if msg.String() == "c" {
|
if msg.String() == "c" {
|
||||||
err := m.CopyToClipboard()
|
err := m.CopyToClipboard()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return m, tea.Quit
|
go m.SendMessage(err.Error(), 5*time.Second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if msg.String() == ">" {
|
if msg.String() == ">" {
|
||||||
@ -837,12 +837,12 @@ func (m *mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle mouse
|
// handle mouse
|
||||||
case tea.MouseMsg:
|
case tea.MouseButton:
|
||||||
if msg.Type == 5 {
|
if msg == 5 {
|
||||||
m.list.CursorUp()
|
m.list.CursorUp()
|
||||||
}
|
}
|
||||||
if msg.Type == 6 {
|
if msg == 6 {
|
||||||
m.list.CursorDown()
|
m.list.CursorUp()
|
||||||
}
|
}
|
||||||
|
|
||||||
// window size -1 to handle search bar
|
// window size -1 to handle search bar
|
||||||
|
Loading…
Reference in New Issue
Block a user