Skip to content

Commit

Permalink
Merge pull request #98 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 0.1.0
  • Loading branch information
andyone authored Apr 1, 2024
2 parents be8e22c + 0d2c7a8 commit 6943e09
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 225 deletions.
2 changes: 1 addition & 1 deletion .docker/alpine.docker
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG REGISTRY="docker.io"

## BUILDER #####################################################################

FROM golang:alpine as builder
FROM golang:alpine3.17 as builder

WORKDIR /go/src/github.com/essentialkaos/rsz

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

strategy:
matrix:
go: [ '1.20.x', '1.21.x' ]
go: [ '1.21.x', '1.22.x' ]

steps:
- name: Checkout
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor
rsz
51 changes: 28 additions & 23 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cli

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Copyright (c) 2024 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand All @@ -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 @@ -286,8 +290,8 @@ func parseSize(size string, bounds image.Rectangle) (int, int, error) {

// parseExactSize parses exact image size
func parseExactSize(size string) (int, int, error) {
ws := strutil.ReadField(size, 0, false, "x")
hs := strutil.ReadField(size, 1, false, "x")
ws := strutil.ReadField(size, 0, false, 'x')
hs := strutil.ReadField(size, 1, false, 'x')

w, err := strconv.Atoi(ws)

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.

8 changes: 4 additions & 4 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.92.0
github.com/essentialkaos/ek/v12 v12.113.1
)

require (
golang.org/x/image v0.14.0 // indirect
golang.org/x/sys v0.15.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
)
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44am
github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1nkuKk=
github.com/essentialkaos/depsy v1.1.0 h1:U6dp687UkQwXlZU17Hg2KMxbp3nfZAoZ8duaeUFYvJI=
github.com/essentialkaos/depsy v1.1.0/go.mod h1:kpiTAV17dyByVnrbNaMcZt2jRwvuXClUYOzpyJQwtG8=
github.com/essentialkaos/ek/v12 v12.92.0 h1:3JIkHWNA6MNkJOfqzMWJ8jN9sRM7nRi7URoFRVFHZzI=
github.com/essentialkaos/ek/v12 v12.92.0/go.mod h1:9efMqo1S8EtYhmeelOSTmMQDGC2vRgPkjkKKfvUD2eU=
github.com/essentialkaos/ek/v12 v12.113.1 h1:3opV9dwRpIQq1fqg5mkaSEt6ogECL4VLzrH/829qeYg=
github.com/essentialkaos/ek/v12 v12.113.1/go.mod h1:SslW97Se34YQKc08Ume2V/8h/HPTgLS1+Iok64cNF/U=
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/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
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=
2 changes: 1 addition & 1 deletion rsz.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Copyright (c) 2024 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down

0 comments on commit 6943e09

Please sign in to comment.