Skip to content

Commit

Permalink
Merge pull request #64 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 2.7.0
  • Loading branch information
andyone committed Jan 13, 2021
2 parents 5ca6978 + fccb609 commit 0004cc8
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 38 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
################################################################################

# This Makefile generated by GoMakeGen 1.3.0 using next command:
# This Makefile generated by GoMakeGen 1.3.2 using next command:
# gomakegen .
#
# More info: https://kaos.sh/gomakegen
Expand Down Expand Up @@ -28,7 +28,7 @@ git-config: ## Configure git redirects for stable import path services

deps: git-config ## Download dependencies
go get -d -v pkg.re/essentialkaos/ek.v12
go get -d -v pkg.re/essentialkaos/sslscan.v12
go get -d -v pkg.re/essentialkaos/sslscan.v13

fmt: ## Format source code with gofmt
find . -name "*.go" -exec gofmt -s -w {} \;
Expand All @@ -44,6 +44,6 @@ help: ## Show this info
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[33m%-12s\033[0m %s\n", $$1, $$2}'
@echo -e ''
@echo -e '\033[90mGenerated by GoMakeGen 1.3.0\033[0m\n'
@echo -e '\033[90mGenerated by GoMakeGen 1.3.2\033[0m\n'

################################################################################
80 changes: 52 additions & 28 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cli

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2020 ESSENTIAL KAOS //
// Copyright (c) 2021 ESSENTIAL KAOS //
// Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand All @@ -26,16 +26,17 @@ import (
"pkg.re/essentialkaos/ek.v12/usage/completion/bash"
"pkg.re/essentialkaos/ek.v12/usage/completion/fish"
"pkg.re/essentialkaos/ek.v12/usage/completion/zsh"
"pkg.re/essentialkaos/ek.v12/usage/man"
"pkg.re/essentialkaos/ek.v12/usage/update"

"pkg.re/essentialkaos/sslscan.v12"
"pkg.re/essentialkaos/sslscan.v13"
)

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

const (
APP = "SSLScan Client"
VER = "2.6.0"
VER = "2.7.0"
DESC = "Command-line client for the SSL Labs API"
)

Expand All @@ -53,7 +54,8 @@ const (
OPT_HELP = "h:help"
OPT_VER = "v:version"

OPT_COMPLETION = "completion"
OPT_COMPLETION = "completion"
OPT_GENERATE_MAN = "generate-man"
)

const (
Expand Down Expand Up @@ -101,7 +103,8 @@ var optMap = options.Map{
OPT_HELP: {Type: options.BOOL, Alias: "u:usage"},
OPT_VER: {Type: options.BOOL, Alias: "ver"},

OPT_COMPLETION: {},
OPT_COMPLETION: {},
OPT_GENERATE_MAN: {Type: options.BOOL},
}

var gradeNumMap = map[string]float64{
Expand Down Expand Up @@ -139,7 +142,11 @@ func Init() {
}

if options.Has(OPT_COMPLETION) {
genCompletion()
os.Exit(genCompletion())
}

if options.Has(OPT_GENERATE_MAN) {
os.Exit(genMan())
}

configureUI()
Expand Down Expand Up @@ -594,6 +601,41 @@ func showUsage() {
genUsage().Render()
}

// showAbout prints info about version
func showAbout() {
genAbout().Render()
}

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

return 0
}

// genCompletion generates completion for different shells
func genCompletion() int {
info := genUsage()

switch options.GetS(OPT_COMPLETION) {
case "bash":
fmt.Printf(bash.Generate(info, "sslcli"))
case "fish":
fmt.Printf(fish.Generate(info, "sslcli"))
case "zsh":
fmt.Printf(zsh.Generate(info, optMap, "sslcli"))
default:
return 1
}

return 0
}

// genUsage generates usage info
func genUsage() *usage.Info {
info := usage.NewInfo("", "host…")
Expand All @@ -620,35 +662,17 @@ func genUsage() *usage.Info {
return info
}

// genCompletion generates completion for different shells
func genCompletion() {
info := genUsage()

switch options.GetS(OPT_COMPLETION) {
case "bash":
fmt.Printf(bash.Generate(info, "sslcli"))
case "fish":
fmt.Printf(fish.Generate(info, "sslcli"))
case "zsh":
fmt.Printf(zsh.Generate(info, optMap, "sslcli"))
default:
os.Exit(1)
}

os.Exit(0)
}

// showAbout prints info about version
func showAbout() {
// genAbout generates info about version
func genAbout() *usage.About {
about := &usage.About{
App: APP,
Version: VER,
Desc: DESC,
Year: 2009,
Owner: "Essential Kaos",
Owner: "ESSENTIAL KAOS",
License: "Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0>",
UpdateChecker: usage.UpdateChecker{"essentialkaos/sslcli", update.GitHubChecker},
}

about.Render()
return about
}
4 changes: 2 additions & 2 deletions cli/details.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cli

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2020 ESSENTIAL KAOS //
// Copyright (c) 2021 ESSENTIAL KAOS //
// Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand All @@ -19,7 +19,7 @@ import (
"pkg.re/essentialkaos/ek.v12/strutil"
"pkg.re/essentialkaos/ek.v12/timeutil"

"pkg.re/essentialkaos/sslscan.v12"
"pkg.re/essentialkaos/sslscan.v13"
)

// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion cli/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cli

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2020 ESSENTIAL KAOS //
// Copyright (c) 2021 ESSENTIAL KAOS //
// Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
22 changes: 19 additions & 3 deletions common/sslcli.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

################################################################################

%global crc_check pushd ../SOURCES ; sha512sum -c %{SOURCE100} ; popd

################################################################################

%define debug_package %{nil}

################################################################################
Expand Down Expand Up @@ -44,17 +48,19 @@

Summary: Pretty awesome command-line client for public SSLLabs API
Name: sslcli
Version: 2.6.0
Version: 2.7.0
Release: 0%{?dist}
Group: Applications/System
License: Apache License, Version 2.0
URL: https://github.com/essentialkaos/sslcli
URL: https://kaos.sh/sslcli

Source0: https://source.kaos.st/%{name}/%{name}-%{version}.tar.bz2

Source100: checksum.sha512

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: golang >= 1.13
BuildRequires: golang >= 1.14

Provides: %{name} = %{version}-%{release}

Expand All @@ -66,6 +72,8 @@ Pretty awesome command-line client for public SSLLabs API.
################################################################################

%prep
%{crc_check}

%setup -q

%build
Expand All @@ -76,8 +84,12 @@ go build src/github.com/essentialkaos/sslcli/%{name}.go
rm -rf %{buildroot}

install -dm 755 %{buildroot}%{_bindir}
install -dm 755 %{buildroot}%{_mandir}/man1

install -pm 755 %{name} %{buildroot}%{_bindir}/

./%{name} --generate-man > %{buildroot}%{_mandir}/man1/%{name}.1

%clean
rm -rf %{buildroot}

Expand Down Expand Up @@ -114,11 +126,15 @@ fi
%files
%defattr(-,root,root,-)
%doc LICENSE
%{_mandir}/man1/%{name}.1.*
%{_bindir}/%{name}

################################################################################

%changelog
* Wed Jan 13 2021 Anton Novojilov <andy@essentialkaos.com> - 2.7.0-0
- sslscan package updated to v13

* Wed May 06 2020 Anton Novojilov <andy@essentialkaos.com> - 2.6.0-0
- Fixed panic if HPKPPolicy is empty
- ek package updated to v12
Expand Down
2 changes: 1 addition & 1 deletion sslcli.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package main

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

0 comments on commit 0004cc8

Please sign in to comment.