Skip to content

Commit

Permalink
Improved support information gathering
Browse files Browse the repository at this point in the history
  • Loading branch information
andyone committed Mar 28, 2024
1 parent 816c28f commit 18e2466
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 213 deletions.
45 changes: 25 additions & 20 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
"github.com/essentialkaos/ek/v12/fsutil"
"github.com/essentialkaos/ek/v12/options"
"github.com/essentialkaos/ek/v12/strutil"
"github.com/essentialkaos/ek/v12/support"
"github.com/essentialkaos/ek/v12/support/deps"
"github.com/essentialkaos/ek/v12/terminal/tty"
"github.com/essentialkaos/ek/v12/usage"
"github.com/essentialkaos/ek/v12/usage/completion/bash"
Expand All @@ -28,16 +30,14 @@ import (
"github.com/essentialkaos/ek/v12/usage/update"

"github.com/disintegration/imaging"

"github.com/essentialkaos/rsz/cli/support"
)

// ////////////////////////////////////////////////////////////////////////////////// //

// Basic utility info
const (
APP = "rsz"
VER = "0.0.6"
VER = "0.1.0"
DESC = "Simple utility for image resizing"
)

Expand Down Expand Up @@ -112,19 +112,23 @@ func Init(gitRev string, gomod []byte) {
case options.Has(OPT_COMPLETION):
os.Exit(genCompletion())
case options.Has(OPT_GENERATE_MAN):
os.Exit(genMan())
printMan()
os.Exit(0)
case options.GetB(OPT_VER):
genAbout(gitRev).Print(options.GetS(OPT_VER))
return
os.Exit(0)
case options.GetB(OPT_VERB_VER):
support.Print(APP, VER, gitRev, gomod)
return
support.Collect(APP, VER).
WithRevision(gitRev).
WithDeps(deps.Extract(gomod)).
Print()
os.Exit(0)
case options.GetB(OPT_LIST_FILTERS):
listFilters()
return
os.Exit(0)
case options.GetB(OPT_HELP) || len(args) < 3:
genUsage().Print()
return
os.Exit(0)
}

process(args)
Expand Down Expand Up @@ -360,16 +364,14 @@ func genCompletion() int {
return 0
}

// genMan generates man page
func genMan() int {
// printMan prints man page
func printMan() {
fmt.Println(
man.Generate(
genUsage(),
genAbout(""),
),
)

return 0
}

// genUsage generates usage info
Expand Down Expand Up @@ -408,17 +410,20 @@ func genUsage() *usage.Info {
// genAbout generates info about version
func genAbout(gitRev string) *usage.About {
about := &usage.About{
App: APP,
Version: VER,
Desc: DESC,
Year: 2009,
Owner: "ESSENTIAL KAOS",
License: "Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>",
UpdateChecker: usage.UpdateChecker{"essentialkaos/rsz", update.GitHubChecker},
App: APP,
Version: VER,
Desc: DESC,
Year: 2009,
Owner: "ESSENTIAL KAOS",
License: "Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>",
}

if gitRev != "" {
about.Build = "git:" + gitRev
about.UpdateChecker = usage.UpdateChecker{
"essentialkaos/rsz",
update.GitHubChecker,
}
}

return about
Expand Down
189 changes: 0 additions & 189 deletions cli/support/support.go

This file was deleted.

4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ go 1.18

require (
github.com/disintegration/imaging v1.6.2
github.com/essentialkaos/depsy v1.1.0
github.com/essentialkaos/ek/v12 v12.111.1
)

require (
golang.org/x/image v0.14.0 // indirect
github.com/essentialkaos/depsy v1.1.0 // indirect
golang.org/x/image v0.15.0 // indirect
golang.org/x/sys v0.18.0 // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.14.0 h1:tNgSxAFe3jC4uYqvZdTr84SZoM1KfwdC9SKIFrLjFn4=
golang.org/x/image v0.14.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE=
golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8=
golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

0 comments on commit 18e2466

Please sign in to comment.