Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 3.2.0 #161

Merged
merged 22 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
213fbf1
Bump github.com/essentialkaos/ek/v12 from 12.82.0 to 12.83.1
dependabot[bot] Oct 24, 2023
8d93927
Merge pull request #152 from essentialkaos/dependabot/go_modules/deve…
andyone Oct 25, 2023
c7c2329
Bump github.com/essentialkaos/ek/v12 from 12.83.1 to 12.83.2
dependabot[bot] Nov 2, 2023
2b48888
Merge pull request #153 from essentialkaos/dependabot/go_modules/deve…
andyone Nov 2, 2023
f9272cc
Bump github.com/essentialkaos/ek/v12 from 12.83.2 to 12.84.0
dependabot[bot] Nov 14, 2023
793b186
Merge pull request #154 from essentialkaos/dependabot/go_modules/deve…
andyone Nov 14, 2023
c2a3e39
Bump github.com/essentialkaos/ek/v12 from 12.84.0 to 12.85.0
dependabot[bot] Nov 15, 2023
85e8513
Merge pull request #155 from essentialkaos/dependabot/go_modules/deve…
andyone Nov 15, 2023
e110d19
Bump github.com/essentialkaos/ek/v12 from 12.85.0 to 12.86.0
dependabot[bot] Nov 17, 2023
8ff5ef8
Merge pull request #156 from essentialkaos/dependabot/go_modules/deve…
andyone Nov 17, 2023
ce15b37
Bump github.com/essentialkaos/ek/v12 from 12.86.0 to 12.88.1
dependabot[bot] Nov 22, 2023
12b7dac
Merge pull request #158 from essentialkaos/dependabot/go_modules/deve…
andyone Nov 22, 2023
c648913
Bump github.com/essentialkaos/ek/v12 from 12.88.1 to 12.90.0
dependabot[bot] Nov 27, 2023
15e4282
Merge pull request #159 from essentialkaos/dependabot/go_modules/deve…
andyone Nov 29, 2023
be9200f
Bump github.com/essentialkaos/ek/v12 from 12.90.0 to 12.90.1
dependabot[bot] Dec 4, 2023
8d10e14
Merge pull request #160 from essentialkaos/dependabot/go_modules/deve…
andyone Dec 4, 2023
bf39c13
Regenerate Makefile with the latest version of gomakegen
andyone Dec 5, 2023
3b1ba01
Code refactoring
andyone Dec 5, 2023
3e8ed05
Add '-P'/'--pager' option to use pager for long output
andyone Dec 5, 2023
71b1e35
Update spec
andyone Dec 5, 2023
082e6c0
Improvements
andyone Dec 6, 2023
2766699
Fix check for colors support
andyone Dec 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
################################################################################

# This Makefile generated by GoMakeGen 2.2.0 using next command:
# This Makefile generated by GoMakeGen 2.3.0 using next command:
# gomakegen --mod .
#
# More info: https://kaos.sh/gomakegen
Expand All @@ -13,6 +13,7 @@ ifdef VERBOSE ## Print verbose information (Flag)
VERBOSE_FLAG = -v
endif

COMPAT ?= 1.18
MAKEDIR = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
GITREV ?= $(shell test -s $(MAKEDIR)/.git && git rev-parse --short HEAD)

Expand Down Expand Up @@ -60,7 +61,7 @@ else
endif

ifdef COMPAT ## Compatible Go version (String)
go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT)
go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT) -go=$(COMPAT)
else
go mod tidy $(VERBOSE_FLAG)
endif
Expand Down Expand Up @@ -106,6 +107,6 @@ help: ## Show this info
| sed 's/ifdef //' \
| awk 'BEGIN {FS = " .*?## "}; {printf " \033[32m%-14s\033[0m %s\n", $$1, $$2}'
@echo -e ''
@echo -e '\033[90mGenerated by GoMakeGen 2.2.0\033[0m\n'
@echo -e '\033[90mGenerated by GoMakeGen 2.3.0\033[0m\n'

################################################################################
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

### Installation

#### From [ESSENTIAL KAOS Public Repository](https://pkgs.kaos.st)
#### From [ESSENTIAL KAOS Public Repository](https://kaos.sh/kaos-repo)

```bash
sudo yum install -y https://pkgs.kaos.st/kaos-repo-latest.el$(grep 'CPE_NAME' /etc/os-release | tr -d '"' | cut -d':' -f5).noarch.rpm
Expand All @@ -43,6 +43,7 @@ Options
--ruby-version, -r Install version defined in version file
--info, -i Print detailed info about version
--all, -a Print all available versions
--pager, -P Use pager for long output
--no-progress, -np Disable progress bar and spinner
--no-color, -nc Disable colors in output
--help, -h Show this help message
Expand Down
58 changes: 28 additions & 30 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/essentialkaos/ek/v12/knf"
"github.com/essentialkaos/ek/v12/log"
"github.com/essentialkaos/ek/v12/options"
"github.com/essentialkaos/ek/v12/pager"
"github.com/essentialkaos/ek/v12/passwd"
"github.com/essentialkaos/ek/v12/path"
"github.com/essentialkaos/ek/v12/progress"
Expand All @@ -39,6 +40,7 @@ import (
"github.com/essentialkaos/ek/v12/strutil"
"github.com/essentialkaos/ek/v12/system"
"github.com/essentialkaos/ek/v12/terminal"
"github.com/essentialkaos/ek/v12/terminal/tty"
"github.com/essentialkaos/ek/v12/terminal/window"
"github.com/essentialkaos/ek/v12/timeutil"
"github.com/essentialkaos/ek/v12/tmp"
Expand All @@ -65,7 +67,7 @@ import (
// App info
const (
APP = "RBInstall"
VER = "3.1.0"
VER = "3.2.0"
DESC = "Utility for installing prebuilt Ruby versions to rbenv"
)

Expand All @@ -82,6 +84,7 @@ const (
OPT_RUBY_VERSION = "r:ruby-version"
OPT_INFO = "i:info"
OPT_ALL = "a:all"
OPT_PAGER = "P:pager"
OPT_NO_COLOR = "nc:no-color"
OPT_NO_PROGRESS = "np:no-progress"
OPT_HELP = "h:help"
Expand Down Expand Up @@ -150,6 +153,7 @@ var optMap = options.Map{
OPT_REHASH: {Type: options.BOOL},
OPT_ALL: {Type: options.BOOL},
OPT_INFO: {Type: options.BOOL},
OPT_PAGER: {Type: options.BOOL},
OPT_NO_COLOR: {Type: options.BOOL},
OPT_NO_PROGRESS: {Type: options.BOOL},
OPT_HELP: {Type: options.BOOL},
Expand Down Expand Up @@ -236,26 +240,13 @@ func Run(gitRev string, gomod []byte) {

// preConfigureUI preconfigures UI based on information about user terminal
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
}
}

if !fsutil.IsCharacterDevice("/dev/stdout") && os.Getenv("FAKETTY") == "" {
if !fmtc.IsColorsSupported() {
fmtc.DisableColors = true
useRawOutput = true
}

if os.Getenv("NO_COLOR") != "" {
if !tty.IsTTY() {
fmtc.DisableColors = true
useRawOutput = true
}
}

Expand All @@ -267,11 +258,11 @@ func configureUI() {

switch {
case fmtc.IsTrueColorSupported():
colorTagApp, colorTagVer = "{#CC1E2C}", "{#CC1E2C}"
colorTagApp, colorTagVer = "{*}{#CC1E2C}", "{#CC1E2C}"
case fmtc.Is256ColorsSupported():
colorTagApp, colorTagVer = "{#160}", "{#160}"
colorTagApp, colorTagVer = "{*}{#160}", "{#160}"
default:
colorTagApp, colorTagVer = "{r}", "{r}"
colorTagApp, colorTagVer = "{*}{r}", "{r}"
}

if fmtc.IsTrueColorSupported() || fmtc.Is256ColorsSupported() {
Expand Down Expand Up @@ -553,6 +544,12 @@ func listCommand() {

// printPrettyListing print info about listing with colors in table view
func printPrettyListing(dist, arch string) {
if options.GetB(OPT_PAGER) {
if pager.Setup() == nil {
defer pager.Complete()
}
}

ruby := repoIndex.GetCategoryData(dist, arch, index.CATEGORY_RUBY, options.GetB(OPT_ALL))
jruby := repoIndex.GetCategoryData(dist, arch, index.CATEGORY_JRUBY, options.GetB(OPT_ALL))
truffle := repoIndex.GetCategoryData(dist, arch, index.CATEGORY_TRUFFLE, options.GetB(OPT_ALL))
Expand Down Expand Up @@ -1826,7 +1823,7 @@ func printMan() {
func genUsage() *usage.Info {
info := usage.NewInfo("", "version")

info.AppNameColorTag = "{*}" + colorTagApp
info.AppNameColorTag = colorTagApp

info.AddOption(OPT_REINSTALL, "Reinstall already installed version {s-}(if allowed in configuration file){!}")
info.AddOption(OPT_UNINSTALL, "Uninstall already installed version {s-}(if allowed in configuration file){!}")
Expand All @@ -1837,6 +1834,7 @@ func genUsage() *usage.Info {
info.AddOption(OPT_RUBY_VERSION, "Install version defined in version file")
info.AddOption(OPT_INFO, "Print detailed info about version")
info.AddOption(OPT_ALL, "Print all available versions")
info.AddOption(OPT_PAGER, "Use pager for long output")
info.AddOption(OPT_NO_PROGRESS, "Disable progress bar and spinner")
info.AddOption(OPT_NO_COLOR, "Disable colors in output")
info.AddOption(OPT_HELP, "Show this help message")
Expand All @@ -1856,10 +1854,15 @@ 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: 2006,
App: APP,
Version: VER,
Desc: DESC,
Year: 2006,

AppNameColorTag: colorTagApp,
VersionColorTag: colorTagVer,
DescSeparator: "{s}—{!}",

Owner: "ESSENTIAL KAOS",
License: "Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>",
UpdateChecker: usage.UpdateChecker{"essentialkaos/rbinstall", update.GitHubChecker},
Expand All @@ -1869,10 +1872,5 @@ func genAbout(gitRev string) *usage.About {
about.Build = "git:" + gitRev
}

if fmtc.Is256ColorsSupported() {
about.AppNameColorTag = "{*}" + colorTagApp
about.VersionColorTag = colorTagVer
}

return about
}
37 changes: 13 additions & 24 deletions clone/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"io"
"os"
"runtime"
"strings"
"time"

"github.com/essentialkaos/ek/v12/fmtc"
Expand All @@ -27,6 +26,7 @@ import (
"github.com/essentialkaos/ek/v12/progress"
"github.com/essentialkaos/ek/v12/req"
"github.com/essentialkaos/ek/v12/terminal"
"github.com/essentialkaos/ek/v12/terminal/tty"
"github.com/essentialkaos/ek/v12/timeutil"
"github.com/essentialkaos/ek/v12/usage"
"github.com/essentialkaos/ek/v12/usage/completion/bash"
Expand All @@ -43,7 +43,7 @@ import (
// App info
const (
APP = "RBInstall Clone"
VER = "3.0.3"
VER = "3.1.0"
DESC = "Utility for cloning RBInstall repository"
)

Expand Down Expand Up @@ -139,24 +139,11 @@ func Run(gitRev string, gomod []byte) {

// preConfigureUI preconfigures UI based on information about user terminal
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
}
}

if !fsutil.IsCharacterDevice("/dev/stdout") && os.Getenv("FAKETTY") == "" {
if !fmtc.IsColorsSupported() {
fmtc.DisableColors = true
}

if os.Getenv("NO_COLOR") != "" {
if !tty.IsTTY() {
fmtc.DisableColors = true
}
}
Expand All @@ -172,11 +159,11 @@ func configureUI() {

switch {
case fmtc.IsTrueColorSupported():
colorTagApp, colorTagVer = "{#CC1E2C}", "{#CC1E2C}"
colorTagApp, colorTagVer = "{*}{#CC1E2C}", "{#CC1E2C}"
case fmtc.Is256ColorsSupported():
colorTagApp, colorTagVer = "{#160}", "{#160}"
colorTagApp, colorTagVer = "{*}{#160}", "{#160}"
default:
colorTagApp, colorTagVer = "{r}", "{r}"
colorTagApp, colorTagVer = "{*}{r}", "{r}"
}
}

Expand Down Expand Up @@ -526,7 +513,7 @@ func printMan() {
func genUsage() *usage.Info {
info := usage.NewInfo("", "url", "path")

info.AppNameColorTag = "{*}" + colorTagApp
info.AppNameColorTag = colorTagApp

info.AddOption(OPT_YES, `Answer "yes" to all questions`)
info.AddOption(OPT_NO_COLOR, "Disable colors in output")
Expand All @@ -548,11 +535,13 @@ func genAbout(gitRev string) *usage.About {
Version: VER,
Desc: DESC,
Year: 2006,
Owner: "ESSENTIAL KAOS",
License: "Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>",

AppNameColorTag: "{*}" + colorTagApp,
AppNameColorTag: colorTagApp,
VersionColorTag: colorTagVer,
DescSeparator: "{s}—{!}",

Owner: "ESSENTIAL KAOS",
License: "Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>",
}

if gitRev != "" {
Expand Down
12 changes: 9 additions & 3 deletions common/rbinstall.spec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

Summary: Utility for installing prebuilt Ruby to rbenv
Name: rbinstall
Version: 3.1.2
Version: 3.2.0
Release: 0%{?dist}
Group: Applications/System
License: Apache License, Version 2.0
Expand Down Expand Up @@ -38,7 +38,7 @@ Utility for installing different prebuilt versions of Ruby to rbenv.
%package gen

Summary: Utility for generating RBInstall index
Version: 3.1.0
Version: 3.2.0
Release: 0%{?dist}
Group: Development/Tools

Expand All @@ -50,7 +50,7 @@ Utility for generating RBInstall index.
%package clone

Summary: Utility for cloning RBInstall repository
Version: 3.0.5
Version: 3.1.0
Release: 0%{?dist}
Group: Development/Tools

Expand Down Expand Up @@ -118,6 +118,12 @@ rm -rf %{buildroot}
################################################################################

%changelog
* Wed Dec 06 2023 Anton Novojilov <[email protected]> - 3.2.0-0
- [cli] Added '-P'/'--pager' option to use pager for long output of versions
- [cli|gen|clone] Improve verbose version info
- [cli|gen|clone] Code refactoring
- Dependencies update

* Tue Oct 17 2023 Anton Novojilov <[email protected]> - 3.1.2-0
- [gen] Improved alias and eol info handling
- [cli|gen|clone] Improve verbose version info
Expand Down
Loading