Skip to content

Commit

Permalink
Use any instead of interface{}, update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
mjwhitta committed Jul 22, 2023
1 parent 77473b9 commit e947caf
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 97 deletions.
6 changes: 3 additions & 3 deletions cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func New(version string) *ArtCache {
var vers = c.GetString("version")

// Initialize defaults
c.SetDefault(map[string]interface{}{}, "art")
c.SetDefault(map[string]any{}, "art")
c.SetDefault(c.version, "version")
c.SaveDefault()
c.Reset()
Expand Down Expand Up @@ -206,7 +206,7 @@ func (c *ArtCache) organize() error {

// Refresh will read any found JSON files and update the art cache.
func (c *ArtCache) Refresh() error {
var arts = map[string]interface{}{}
var arts = map[string]any{}
var e error

// Save with initial empty data
Expand All @@ -227,7 +227,7 @@ func (c *ArtCache) Refresh() error {
return e
}

arts[a.Name] = map[string]interface{}{
arts[a.Name] = map[string]any{
"file": path,
"height": a.Height,
"width": a.Width,
Expand Down
81 changes: 31 additions & 50 deletions cmd/arTTY/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,54 +80,41 @@ func init() {
cli.Authors = []string{"Miles Whittaker <mj@whitta.dev>"}
cli.Banner = hl.Sprintf("%s [OPTIONS] [art]", os.Args[0])
cli.BugEmail = "arTTY.bugs@whitta.dev"
cli.ExitStatus = strings.Join(
[]string{
"Normally the exit status is 0. In the event of an error",
"the exit status will be one of the below:\n\n",
hl.Sprintf("%d: Invalid option\n", InvalidOption),
hl.Sprintf("%d: Missing option\n", MissingOption),
hl.Sprintf("%d: Invalid argument\n", InvalidArgument),
hl.Sprintf("%d: Missing argument\n", MissingArgument),
hl.Sprintf("%d: Extra argument\n", ExtraArgument),
hl.Sprintf("%d: Exception", Exception),
},
" ",
cli.ExitStatus(
"Normally the exit status is 0. In the event of an error the",
"exit status will be one of the below:\n\n",
hl.Sprintf("%d: Invalid option\n", InvalidOption),
hl.Sprintf("%d: Missing option\n", MissingOption),
hl.Sprintf("%d: Invalid argument\n", InvalidArgument),
hl.Sprintf("%d: Missing argument\n", MissingArgument),
hl.Sprintf("%d: Extra argument\n", ExtraArgument),
hl.Sprintf("%d: Exception", Exception),
)
cli.Info = "Art for your TTY."
cli.Info("Art for your TTY.")
cli.Section(
"FIELDS",
strings.Join(
[]string{
"blank: Use a blank line as a separator\n",
"colors: Show terminal colors\n",
"cpu: Show cpu info\n",
"fs: Show filesystem usage\n",
"host: Show hostname\n",
"ipv4: Show IPv4 addresses\n",
"ipv6: Show IPv6 addresses\n",
"kernel: Show kernel info\n",
"os: Show operating system info\n",
"ram: Show RAM usage\n",
"shell: Show current shell\n",
"tty: Show TTY info\n",
"uptime: Show uptime",
},
"",
),
"blank: Use a blank line as a separator\n",
"colors: Show terminal colors\n",
"cpu: Show cpu info\n",
"fs: Show filesystem usage\n",
"host: Show hostname\n",
"ipv4: Show IPv4 addresses\n",
"ipv6: Show IPv6 addresses\n",
"kernel: Show kernel info\n",
"os: Show operating system info\n",
"ram: Show RAM usage\n",
"shell: Show current shell\n",
"tty: Show TTY info\n",
"uptime: Show uptime",
)
cli.Section(
"FORMATS",
strings.Join(
[]string{
"bash: Generate bash code\n",
"go: Generate go code\n",
"json: Generate JSON from image file\n",
"stdout: Display art (default)\n",
"python: Generate python code\n",
"ruby: Generate ruby code",
},
"",
),
"bash: Generate bash code\n",
"go: Generate go code\n",
"json: Generate JSON from image file\n",
"stdout: Display art (default)\n",
"python: Generate python code\n",
"ruby: Generate ruby code",
)
cli.Title = "ArTTY"

Expand Down Expand Up @@ -225,14 +212,8 @@ func init() {
"p",
"plain",
false,
strings.Join(
[]string{
"Disable all filtering and flags not explicitly",
"specified (useful for --save or tab-completion with",
"--ls).",
},
" ",
),
"Disable all filtering and flags not explicitly specified",
"(useful for --save or tab-completion with --ls).",
)
cli.Flag(
&flags.random,
Expand Down
2 changes: 1 addition & 1 deletion globals.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ var Cache *cache.ArtCache = cache.New(Version)
var devRegex = regexp.MustCompile(`<a href.+>(.+)</a>`)

// Version is the package version
const Version = "1.4.3"
const Version = "1.4.4"
24 changes: 12 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ module github.com/mjwhitta/artty
go 1.19

require (
github.com/mjwhitta/cli v1.10.1
github.com/mjwhitta/errors v1.0.1
github.com/mjwhitta/hilighter v1.11.2
github.com/mjwhitta/jq v1.5.3
github.com/mjwhitta/jsoncfg v1.6.9
github.com/mjwhitta/log v1.6.3
github.com/mjwhitta/pathname v1.2.4
github.com/mjwhitta/sysinfo v1.5.0
github.com/mjwhitta/where v1.2.7
github.com/stretchr/testify v1.8.2
github.com/mjwhitta/cli v1.11.0
github.com/mjwhitta/errors v1.0.2
github.com/mjwhitta/hilighter v1.11.3
github.com/mjwhitta/jq v1.5.4
github.com/mjwhitta/jsoncfg v1.6.10
github.com/mjwhitta/log v1.6.4
github.com/mjwhitta/pathname v1.2.5
github.com/mjwhitta/sysinfo v1.5.1
github.com/mjwhitta/where v1.2.8
github.com/stretchr/testify v1.8.4
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/mjwhitta/safety v1.11.2 // indirect
github.com/mjwhitta/safety v1.11.3 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/sys v0.10.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
55 changes: 24 additions & 31 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,42 +1,35 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/mjwhitta/cli v1.10.1 h1:Da63yUFyWI8tmyx5L3EH55YRKTE0u6VGFusjxlyzqKc=
github.com/mjwhitta/cli v1.10.1/go.mod h1:65S6kvxR4eYc4IibAI8WxSktIunCZpdet0XaMI2DEws=
github.com/mjwhitta/errors v1.0.1 h1:f12gpCh23cfzXUgtlZBWGs387ZJeEeOemv7hLSvBAx0=
github.com/mjwhitta/errors v1.0.1/go.mod h1:VxHM8bLMPVqkvHiYQq4Nq4sjNqPjUtKLhSF2I0wve5U=
github.com/mjwhitta/hilighter v1.11.2 h1:RKl9BeBjHWNacbQuR3F4yzfUEr1krLwjgFsDI9ZuyZo=
github.com/mjwhitta/hilighter v1.11.2/go.mod h1:0Yzfon7qT8oTfofbA+SGaB21GQshjlOgwDEF6xuCyVc=
github.com/mjwhitta/jq v1.5.3 h1:zvN+htkU8RxbsceXq2myV841N8XjH+RpmtFI5ZVmQvw=
github.com/mjwhitta/jq v1.5.3/go.mod h1:ozcUBoCotu7G6eVjLe7n36uq/AEVWc/kbMF/H6xfFHA=
github.com/mjwhitta/jsoncfg v1.6.9 h1:t8ie+9TsO6qsx8AECReI/8xuIr1ieRSaWGL9ZHeZcxU=
github.com/mjwhitta/jsoncfg v1.6.9/go.mod h1:8cMVk5rkY4acQpzlgqyxi7Yo6EO1Ntwq9odcURzsrkA=
github.com/mjwhitta/log v1.6.3 h1:dY0d9duROyuKytPGCZeC7QZvoLxgvnT/Q8nNFT8V4eI=
github.com/mjwhitta/log v1.6.3/go.mod h1:1GbElSBgBrnzGBa6m/tRuOd0E89QnoPSDpmnN7FdtmE=
github.com/mjwhitta/pathname v1.2.4 h1:DMVRSdMuvV2UGoyJ0KIEmzebWezSiVCC3NaEcz8rqM8=
github.com/mjwhitta/pathname v1.2.4/go.mod h1:uNt88tqjIY6UB4h1tl3LozHqF7Gdy24Mh7h6YIn/u8s=
github.com/mjwhitta/safety v1.11.2 h1:B3/OO4hOvGvqruSuws4Wcw4+oS3yk3Mo0JV1ylswRyY=
github.com/mjwhitta/safety v1.11.2/go.mod h1:gHrH/EGuzgyTCVvyEopBtXWedRfprip7NCev+gqG2Vg=
github.com/mjwhitta/sysinfo v1.5.0 h1:3csZHStjWbr1nid+zehBP23F02G+8C+Q+jgKB6RkAT4=
github.com/mjwhitta/sysinfo v1.5.0/go.mod h1:Ft3U80rNy/H8FbC6IXEygVmv9dvdh5Shl+X3LPuxnYg=
github.com/mjwhitta/where v1.2.7 h1:zsPTJJzcTF+MQcSCqXQwemZ12UD4nKTn9UP3bP6oVcQ=
github.com/mjwhitta/where v1.2.7/go.mod h1:zdiceX2IBG1ZPyAWKwfXVoC9j4i7c51de2S6AF012X8=
github.com/mjwhitta/cli v1.11.0 h1:Y38x9ZMq6FZMRTcUSJDV35sDu2kAlkz4Nwf4fX9Owww=
github.com/mjwhitta/cli v1.11.0/go.mod h1:NnyhgKZy85L4PVuZBC+gi2b8bSty0lglc/0jyWAHdUw=
github.com/mjwhitta/errors v1.0.2 h1:5QmN4kKfFwYiSsdASDmoi3ie7HesdU7pNDqlhXE9nuU=
github.com/mjwhitta/errors v1.0.2/go.mod h1:VxHM8bLMPVqkvHiYQq4Nq4sjNqPjUtKLhSF2I0wve5U=
github.com/mjwhitta/hilighter v1.11.3 h1:2r6t8CdSU9HUamK73R1RR9jmH+7QYkh8XGFXZetVCyI=
github.com/mjwhitta/hilighter v1.11.3/go.mod h1:/PQ6zrYVQSuX8s9j05nnjQB+kM4+nj3alMYcxyqFAnY=
github.com/mjwhitta/jq v1.5.4 h1:Qtz19TiwoGvuhswzIX4AK2BnJy+RXQppVSridNDBMqE=
github.com/mjwhitta/jq v1.5.4/go.mod h1:6JdcGqPfEqTmCJq0bEkpQq8JZp9MAxCBeNchR68UmoM=
github.com/mjwhitta/jsoncfg v1.6.10 h1:8SJkA6K6KHCH+MNwdl1os7Zs5xQZnsiI8CAEokL2Se4=
github.com/mjwhitta/jsoncfg v1.6.10/go.mod h1:ctPED06LIU7PZTrvdipoLEvmS+fFMW/lrMJal1R1Fxg=
github.com/mjwhitta/log v1.6.4 h1:lc/7UK9i7hfjVhQSiWhRvgcpqt3X9CoXNGP59bAs06c=
github.com/mjwhitta/log v1.6.4/go.mod h1:/+6cIdTt1mlWG6QNIIXfDdj4Gw0eoPrNEzHEtETiZYQ=
github.com/mjwhitta/pathname v1.2.5 h1:wSUZGv+mCrmndNkX2uak8XMZhkXXbgjYG/dMclGKrUE=
github.com/mjwhitta/pathname v1.2.5/go.mod h1:t0k8GIucdXPKhiKyV4aAWtBA9LhLB7mV50DJlhrMpog=
github.com/mjwhitta/safety v1.11.3 h1:dpg6CIQrlrt8yf/cXEdhPI+vRV6g/cRw8uO/TmUK1Mg=
github.com/mjwhitta/safety v1.11.3/go.mod h1:K/LrHWgnJlD5vCe0c9tH4E2prhl4Xpl6nBelXAvuXo0=
github.com/mjwhitta/sysinfo v1.5.1 h1:5xkPJof2QASxPJYXdmMTudc1tSkzirmCD9m0BxZT05I=
github.com/mjwhitta/sysinfo v1.5.1/go.mod h1:8qDDoBw0YlkJRHTE0mtnNinF8arhal7vJhnAZml4UdU=
github.com/mjwhitta/where v1.2.8 h1:ntR9wmZL6gOTQSqulBorVzOzVXrK3LV9vid84WCJpmw=
github.com/mjwhitta/where v1.2.8/go.mod h1:5LSdFUCeFdLMjQN7POICOJK/mwV7MzZwY+WXoeH3b2I=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 comments on commit e947caf

Please sign in to comment.