Skip to content

Commit

Permalink
Merge pull request #16 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 1.1.1
  • Loading branch information
andyone authored Apr 1, 2024
2 parents 4c98c19 + 16df06b commit 795d743
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 42 deletions.
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
50 changes: 23 additions & 27 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package app

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// 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 @@ -16,14 +16,18 @@ import (
"github.com/essentialkaos/ek/v12/initsystem"
"github.com/essentialkaos/ek/v12/options"
"github.com/essentialkaos/ek/v12/sortutil"
"github.com/essentialkaos/ek/v12/support"
"github.com/essentialkaos/ek/v12/support/deps"
"github.com/essentialkaos/ek/v12/support/pkgs"
"github.com/essentialkaos/ek/v12/terminal/tty"
"github.com/essentialkaos/ek/v12/usage"
)

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

const (
APP = "RDS Migrator"
VER = "1.1.0"
VER = "1.1.1"
DESC = "Utility for migrating Redis-Split metadata to RDS format"
)

Expand All @@ -37,6 +41,8 @@ const (
OPT_NO_COLOR = "nc:no-color"
OPT_HELP = "h:help"
OPT_VER = "v:version"

OPT_VERB_VER = "vv:verbose-version"
)

// ////////////////////////////////////////////////////////////////////////////////// //
Expand All @@ -48,12 +54,15 @@ var optMap = options.Map{
OPT_ROLE: {},
OPT_NO_COLOR: {Type: options.BOOL},
OPT_HELP: {Type: options.BOOL},
OPT_VER: {Type: options.BOOL},
OPT_VER: {Type: options.MIXED},

OPT_VERB_VER: {Type: options.BOOL},
}

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

func Run(gitRev string) {
// Run is main application function
func Run(gitRev string, gomod []byte) {
preConfigureUI()

args, errList := options.Parse(optMap)
Expand All @@ -70,7 +79,14 @@ func Run(gitRev string) {

switch {
case options.GetB(OPT_VER):
genAbout(gitRev).Print()
genAbout(gitRev).Print(options.GetS(OPT_VER))
os.Exit(0)
case options.GetB(OPT_VERB_VER):
support.Collect(APP, VER).
WithRevision(gitRev).
WithDeps(deps.Extract(gomod)).
WithPackages(pkgs.Collect("rds", "rds-sync")).
Print()
os.Exit(0)
case options.GetB(OPT_HELP) || len(args) == 0:
genUsage().Print()
Expand All @@ -86,27 +102,7 @@ func Run(gitRev string) {

// preConfigureUI configure user interface
func preConfigureUI() {
term := os.Getenv("TERM")

fmtc.DisableColors = true

if term != "" {
switch {
case strings.Contains(term, "xterm"),
strings.Contains(term, "color"),
term == "screen":
fmtc.DisableColors = false
}
}

// Check for output redirect using pipes
if fsutil.IsCharacterDevice("/dev/stdin") &&
!fsutil.IsCharacterDevice("/dev/stdout") &&
os.Getenv("FAKETTY") == "" {
fmtc.DisableColors = true
}

if os.Getenv("NO_COLOR") != "" {
if !tty.IsTTY() {
fmtc.DisableColors = true
}
}
Expand Down Expand Up @@ -246,8 +242,8 @@ func genAbout(gitRev string) *usage.About {
Version: VER,
Desc: DESC,
Year: 2009,
License: "Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>",
Owner: "ESSENTIAL KAOS",
License: "Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>",
}

if gitRev != "" {
Expand Down
2 changes: 1 addition & 1 deletion app/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package app

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// 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
2 changes: 1 addition & 1 deletion app/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package app

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// 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
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ module github.com/essentialkaos/rds-migrator

go 1.19

require github.com/essentialkaos/ek/v12 v12.98.0
require github.com/essentialkaos/ek/v12 v12.113.1

require (
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/sys v0.16.0 // indirect
github.com/essentialkaos/depsy v1.1.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/sys v0.18.0 // indirect
)
14 changes: 8 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1nkuKk=
github.com/essentialkaos/ek/v12 v12.98.0 h1:DSoP84rmUpNFjfuk8HSL04lkNLC8EzBo38IYoZ0O1qc=
github.com/essentialkaos/ek/v12 v12.98.0/go.mod h1:peB5w8zUkRuDs7m/QG5Z2gMmqzSIs2viAmxzzNFIIoo=
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.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/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
2 changes: 1 addition & 1 deletion meta/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package meta

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// 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
9 changes: 7 additions & 2 deletions rds-migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,27 @@ 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> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //

import (
_ "embed"

APP "github.com/essentialkaos/rds-migrator/app"
)

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

//go:embed go.mod
var gomod []byte

// gitrev is short hash of the latest git commit
var gitrev string

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

func main() {
APP.Run(gitrev)
APP.Run(gitrev, gomod)
}

0 comments on commit 795d743

Please sign in to comment.