From e21c4d92447476de082e4b90cf66bde3ec36c612 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Aug 2022 02:29:00 +0000 Subject: [PATCH 01/23] Bump github.com/essentialkaos/ek/v12 from 12.53.0 to 12.54.0 Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.53.0 to 12.54.0. - [Release notes](https://github.com/essentialkaos/ek/releases) - [Changelog](https://github.com/essentialkaos/ek/blob/master/CHANGELOG.md) - [Commits](https://github.com/essentialkaos/ek/compare/v12.53.0...v12.54.0) --- updated-dependencies: - dependency-name: github.com/essentialkaos/ek/v12 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 410473f..879b76c 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,6 @@ module github.com/essentialkaos/uc go 1.17 -require github.com/essentialkaos/ek/v12 v12.53.0 +require github.com/essentialkaos/ek/v12 v12.54.0 require golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b // indirect diff --git a/go.sum b/go.sum index 425e2c8..9139ad2 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/essentialkaos/check v1.3.0 h1:ria+8o22RCLdt2D/1SHQsEH5Mmy5S+iWHaGHrrbPUc0= github.com/essentialkaos/check v1.3.0/go.mod h1:PhxzfJWlf5L/skuyhzBLIvjMB5Xu9TIyDIsqpY5MvB8= -github.com/essentialkaos/ek/v12 v12.53.0 h1:sBSzM4ZQ487wRqAIB7kfftqMSi8/HXIr5exJlBbdljA= -github.com/essentialkaos/ek/v12 v12.53.0/go.mod h1:Y8ln7hqABw8GT1vWuU7cCJfZAdE1uxmOYZvOVv8HRzo= +github.com/essentialkaos/ek/v12 v12.54.0 h1:Fxaq9bg+cy6QLYvysMvwsKxgoNKTa93OyQAq7FOyXoE= +github.com/essentialkaos/ek/v12 v12.54.0/go.mod h1:Y8ln7hqABw8GT1vWuU7cCJfZAdE1uxmOYZvOVv8HRzo= github.com/essentialkaos/go-linenoise/v3 v3.4.0/go.mod h1:t1kNLY2bSMQCy1JXOefD2BDLs/TTPMtTv3DFNV5uDSI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= From a492df7fcaf52c350d9791e2e7a94138a274886b Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 17 Aug 2022 12:14:49 +0300 Subject: [PATCH 02/23] Add Go 1.19 to testing targets --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a792aa..08be257 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: - go: [ '1.17.x', '1.18.x' ] + go: [ '1.18.x', '1.19.x' ] steps: - name: Set up Go From f4a0faeb1a78533928d491d8ca92bedcbcecf90f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Sep 2022 02:31:08 +0000 Subject: [PATCH 03/23] Bump github.com/essentialkaos/ek/v12 from 12.54.0 to 12.55.0 Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.54.0 to 12.55.0. - [Release notes](https://github.com/essentialkaos/ek/releases) - [Changelog](https://github.com/essentialkaos/ek/blob/master/CHANGELOG.md) - [Commits](https://github.com/essentialkaos/ek/compare/v12.54.0...v12.55.0) --- updated-dependencies: - dependency-name: github.com/essentialkaos/ek/v12 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 879b76c..5ea4206 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,6 @@ module github.com/essentialkaos/uc go 1.17 -require github.com/essentialkaos/ek/v12 v12.54.0 +require github.com/essentialkaos/ek/v12 v12.55.0 require golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b // indirect diff --git a/go.sum b/go.sum index 9139ad2..60bef4b 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/essentialkaos/check v1.3.0 h1:ria+8o22RCLdt2D/1SHQsEH5Mmy5S+iWHaGHrrbPUc0= github.com/essentialkaos/check v1.3.0/go.mod h1:PhxzfJWlf5L/skuyhzBLIvjMB5Xu9TIyDIsqpY5MvB8= -github.com/essentialkaos/ek/v12 v12.54.0 h1:Fxaq9bg+cy6QLYvysMvwsKxgoNKTa93OyQAq7FOyXoE= -github.com/essentialkaos/ek/v12 v12.54.0/go.mod h1:Y8ln7hqABw8GT1vWuU7cCJfZAdE1uxmOYZvOVv8HRzo= +github.com/essentialkaos/ek/v12 v12.55.0 h1:3pn147r2rqSM+Gv/DTr2B4l5fwrwf4S7ewPWtGzi9pI= +github.com/essentialkaos/ek/v12 v12.55.0/go.mod h1:Y8ln7hqABw8GT1vWuU7cCJfZAdE1uxmOYZvOVv8HRzo= github.com/essentialkaos/go-linenoise/v3 v3.4.0/go.mod h1:t1kNLY2bSMQCy1JXOefD2BDLs/TTPMtTv3DFNV5uDSI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= From 0ebd5ff480d67963ff3b094f1dcd54ec1f004aa1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Sep 2022 02:29:02 +0000 Subject: [PATCH 04/23] Bump github.com/essentialkaos/ek/v12 from 12.55.0 to 12.55.2 Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.55.0 to 12.55.2. - [Release notes](https://github.com/essentialkaos/ek/releases) - [Changelog](https://github.com/essentialkaos/ek/blob/master/CHANGELOG.md) - [Commits](https://github.com/essentialkaos/ek/compare/v12.55.0...v12.55.2) --- updated-dependencies: - dependency-name: github.com/essentialkaos/ek/v12 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5ea4206..8b44606 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,6 @@ module github.com/essentialkaos/uc go 1.17 -require github.com/essentialkaos/ek/v12 v12.55.0 +require github.com/essentialkaos/ek/v12 v12.55.2 require golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b // indirect diff --git a/go.sum b/go.sum index 60bef4b..a1b09ea 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/essentialkaos/check v1.3.0 h1:ria+8o22RCLdt2D/1SHQsEH5Mmy5S+iWHaGHrrbPUc0= github.com/essentialkaos/check v1.3.0/go.mod h1:PhxzfJWlf5L/skuyhzBLIvjMB5Xu9TIyDIsqpY5MvB8= -github.com/essentialkaos/ek/v12 v12.55.0 h1:3pn147r2rqSM+Gv/DTr2B4l5fwrwf4S7ewPWtGzi9pI= -github.com/essentialkaos/ek/v12 v12.55.0/go.mod h1:Y8ln7hqABw8GT1vWuU7cCJfZAdE1uxmOYZvOVv8HRzo= +github.com/essentialkaos/ek/v12 v12.55.2 h1:2E4sbU6k2FvA4OHmsD1I+DXufQ6epzwhw+weZPLYxq8= +github.com/essentialkaos/ek/v12 v12.55.2/go.mod h1:Y8ln7hqABw8GT1vWuU7cCJfZAdE1uxmOYZvOVv8HRzo= github.com/essentialkaos/go-linenoise/v3 v3.4.0/go.mod h1:t1kNLY2bSMQCy1JXOefD2BDLs/TTPMtTv3DFNV5uDSI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= From ace40dfa5d2bf91b9f484818276323149ca449eb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Oct 2022 02:38:12 +0000 Subject: [PATCH 05/23] Bump github.com/essentialkaos/ek/v12 from 12.55.2 to 12.56.0 Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.55.2 to 12.56.0. - [Release notes](https://github.com/essentialkaos/ek/releases) - [Changelog](https://github.com/essentialkaos/ek/blob/master/CHANGELOG.md) - [Commits](https://github.com/essentialkaos/ek/compare/v12.55.2...v12.56.0) --- updated-dependencies: - dependency-name: github.com/essentialkaos/ek/v12 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 8b44606..256b1c6 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,6 @@ module github.com/essentialkaos/uc go 1.17 -require github.com/essentialkaos/ek/v12 v12.55.2 +require github.com/essentialkaos/ek/v12 v12.56.0 -require golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b // indirect +require golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect diff --git a/go.sum b/go.sum index a1b09ea..a8109f7 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/essentialkaos/check v1.3.0 h1:ria+8o22RCLdt2D/1SHQsEH5Mmy5S+iWHaGHrrbPUc0= github.com/essentialkaos/check v1.3.0/go.mod h1:PhxzfJWlf5L/skuyhzBLIvjMB5Xu9TIyDIsqpY5MvB8= -github.com/essentialkaos/ek/v12 v12.55.2 h1:2E4sbU6k2FvA4OHmsD1I+DXufQ6epzwhw+weZPLYxq8= -github.com/essentialkaos/ek/v12 v12.55.2/go.mod h1:Y8ln7hqABw8GT1vWuU7cCJfZAdE1uxmOYZvOVv8HRzo= +github.com/essentialkaos/ek/v12 v12.56.0 h1:Zh6KjIjraQd8/n1gJsL6HTJXozcH9xqmvouSn2g7Nu4= +github.com/essentialkaos/ek/v12 v12.56.0/go.mod h1:G8ghiSKh8ToJQCdB2bAhE3CnI6dn9nTJdWH3bQIVr1U= github.com/essentialkaos/go-linenoise/v3 v3.4.0/go.mod h1:t1kNLY2bSMQCy1JXOefD2BDLs/TTPMtTv3DFNV5uDSI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= @@ -15,13 +15,13 @@ github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsK github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= -golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b h1:2n253B2r0pYSmEV+UNCQoPfU/FiaizQEK5Gu4Bq4JE8= -golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI= +golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From 82c7aa44a78dad10edaf427cfb4f7393cff283c8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Oct 2022 02:43:36 +0000 Subject: [PATCH 06/23] Bump github.com/essentialkaos/ek/v12 from 12.56.0 to 12.57.0 Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.56.0 to 12.57.0. - [Release notes](https://github.com/essentialkaos/ek/releases) - [Changelog](https://github.com/essentialkaos/ek/blob/master/CHANGELOG.md) - [Commits](https://github.com/essentialkaos/ek/compare/v12.56.0...v12.57.0) --- updated-dependencies: - dependency-name: github.com/essentialkaos/ek/v12 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 256b1c6..d769c61 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,6 @@ module github.com/essentialkaos/uc go 1.17 -require github.com/essentialkaos/ek/v12 v12.56.0 +require github.com/essentialkaos/ek/v12 v12.57.0 require golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect diff --git a/go.sum b/go.sum index a8109f7..6b0d8d1 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/essentialkaos/check v1.3.0 h1:ria+8o22RCLdt2D/1SHQsEH5Mmy5S+iWHaGHrrbPUc0= github.com/essentialkaos/check v1.3.0/go.mod h1:PhxzfJWlf5L/skuyhzBLIvjMB5Xu9TIyDIsqpY5MvB8= -github.com/essentialkaos/ek/v12 v12.56.0 h1:Zh6KjIjraQd8/n1gJsL6HTJXozcH9xqmvouSn2g7Nu4= -github.com/essentialkaos/ek/v12 v12.56.0/go.mod h1:G8ghiSKh8ToJQCdB2bAhE3CnI6dn9nTJdWH3bQIVr1U= +github.com/essentialkaos/ek/v12 v12.57.0 h1:FUl5ZUF7czjZXROYVoJamGTWqEIGuZEHrm1DLfzq43I= +github.com/essentialkaos/ek/v12 v12.57.0/go.mod h1:G8ghiSKh8ToJQCdB2bAhE3CnI6dn9nTJdWH3bQIVr1U= github.com/essentialkaos/go-linenoise/v3 v3.4.0/go.mod h1:t1kNLY2bSMQCy1JXOefD2BDLs/TTPMtTv3DFNV5uDSI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= From e8e33e0d46fc27e3442af0a6c0374c240895a22c Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Thu, 1 Dec 2022 00:39:06 +0300 Subject: [PATCH 07/23] Fix RPM build using sources from source.kaos.st --- common/uc.spec | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/common/uc.spec b/common/uc.spec index c216101..b2b8f63 100644 --- a/common/uc.spec +++ b/common/uc.spec @@ -11,7 +11,7 @@ Summary: Simple utility for counting unique lines Name: uc Version: 1.1.0 -Release: 0%{?dist} +Release: 1%{?dist} Group: Applications/System License: Apache License, Version 2.0 URL: https://kaos.sh/uc @@ -20,7 +20,7 @@ Source0: https://source.kaos.st/%{name}/%{name}-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: golang >= 1.17 +BuildRequires: golang >= 1.19 Provides: %{name} = %{version}-%{release} @@ -35,9 +35,9 @@ Simple utility for counting unique lines. %setup -q %build -export GOPATH=$(pwd) -pushd src/github.com/essentialkaos/%{name} - go build -mod vendor -o $GOPATH/%{name} %{name}.go +pushd %{name} + go build %{name}.go + cp LICENSE .. popd %install @@ -46,9 +46,9 @@ rm -rf %{buildroot} install -dm 755 %{buildroot}%{_bindir} install -dm 755 %{buildroot}%{_mandir}/man1 -install -pm 755 %{name} %{buildroot}%{_bindir}/ +install -pm 755 %{name}/%{name} %{buildroot}%{_bindir}/ -./%{name} --generate-man > %{buildroot}%{_mandir}/man1/%{name}.1 +./%{name}/%{name} --generate-man > %{buildroot}%{_mandir}/man1/%{name}.1 %clean rm -rf %{buildroot} @@ -64,6 +64,9 @@ rm -rf %{buildroot} ################################################################################ %changelog +* Thu Dec 01 2022 Anton Novojilov - 1.1.0-1 +- Fixed build using sources from source.kaos.st + * Wed Aug 10 2022 Anton Novojilov - 1.1.0-0 - Minor UI improvements - Fixed bug with parsing max number of unique lines From 5ecd06835e25766acb30b61970250c2350d65900 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Sun, 8 Jan 2023 13:45:27 +0300 Subject: [PATCH 08/23] Improve spec --- common/uc.spec | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/uc.spec b/common/uc.spec index b2b8f63..7d14389 100644 --- a/common/uc.spec +++ b/common/uc.spec @@ -1,9 +1,5 @@ ################################################################################ -# rpmbuilder:relative-pack true - -################################################################################ - %define debug_package %{nil} ################################################################################ @@ -35,6 +31,11 @@ Simple utility for counting unique lines. %setup -q %build +if [[ ! -d "%{name}/vendor" ]] ; then + echo "This package requires vendored dependencies" + exit 1 +fi + pushd %{name} go build %{name}.go cp LICENSE .. From 35dacfdb8fe8e6b32148cb6be90bfb621382540b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Jan 2023 03:16:32 +0000 Subject: [PATCH 09/23] Bump github.com/essentialkaos/ek/v12 from 12.57.0 to 12.57.1 Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.57.0 to 12.57.1. - [Release notes](https://github.com/essentialkaos/ek/releases) - [Changelog](https://github.com/essentialkaos/ek/blob/master/CHANGELOG.md) - [Commits](https://github.com/essentialkaos/ek/compare/v12.57.0...v12.57.1) --- updated-dependencies: - dependency-name: github.com/essentialkaos/ek/v12 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d769c61..6ee02be 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,6 @@ module github.com/essentialkaos/uc go 1.17 -require github.com/essentialkaos/ek/v12 v12.57.0 +require github.com/essentialkaos/ek/v12 v12.57.1 require golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect diff --git a/go.sum b/go.sum index 6b0d8d1..8cbe5e3 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/essentialkaos/check v1.3.0 h1:ria+8o22RCLdt2D/1SHQsEH5Mmy5S+iWHaGHrrbPUc0= github.com/essentialkaos/check v1.3.0/go.mod h1:PhxzfJWlf5L/skuyhzBLIvjMB5Xu9TIyDIsqpY5MvB8= -github.com/essentialkaos/ek/v12 v12.57.0 h1:FUl5ZUF7czjZXROYVoJamGTWqEIGuZEHrm1DLfzq43I= -github.com/essentialkaos/ek/v12 v12.57.0/go.mod h1:G8ghiSKh8ToJQCdB2bAhE3CnI6dn9nTJdWH3bQIVr1U= +github.com/essentialkaos/ek/v12 v12.57.1 h1:9dj32HLCVmseBoa43F6HaZz1qbKts5GNBCtFdrpQPno= +github.com/essentialkaos/ek/v12 v12.57.1/go.mod h1:G8ghiSKh8ToJQCdB2bAhE3CnI6dn9nTJdWH3bQIVr1U= github.com/essentialkaos/go-linenoise/v3 v3.4.0/go.mod h1:t1kNLY2bSMQCy1JXOefD2BDLs/TTPMtTv3DFNV5uDSI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= From 3aee4e304216e486a1b77615dd27af0246922080 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Feb 2023 03:16:58 +0000 Subject: [PATCH 10/23] Bump github.com/essentialkaos/ek/v12 from 12.57.1 to 12.58.0 Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.57.1 to 12.58.0. - [Release notes](https://github.com/essentialkaos/ek/releases) - [Changelog](https://github.com/essentialkaos/ek/blob/master/CHANGELOG.md) - [Commits](https://github.com/essentialkaos/ek/compare/v12.57.1...v12.58.0) --- updated-dependencies: - dependency-name: github.com/essentialkaos/ek/v12 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 6ee02be..be68f9b 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,6 @@ module github.com/essentialkaos/uc go 1.17 -require github.com/essentialkaos/ek/v12 v12.57.1 +require github.com/essentialkaos/ek/v12 v12.58.0 require golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect diff --git a/go.sum b/go.sum index 8cbe5e3..b48d0a7 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/essentialkaos/check v1.3.0 h1:ria+8o22RCLdt2D/1SHQsEH5Mmy5S+iWHaGHrrbPUc0= github.com/essentialkaos/check v1.3.0/go.mod h1:PhxzfJWlf5L/skuyhzBLIvjMB5Xu9TIyDIsqpY5MvB8= -github.com/essentialkaos/ek/v12 v12.57.1 h1:9dj32HLCVmseBoa43F6HaZz1qbKts5GNBCtFdrpQPno= -github.com/essentialkaos/ek/v12 v12.57.1/go.mod h1:G8ghiSKh8ToJQCdB2bAhE3CnI6dn9nTJdWH3bQIVr1U= +github.com/essentialkaos/ek/v12 v12.58.0 h1:k0HIBV4w0te4Yr/j5apowXvq1tLP3kbmZdyvxP4YkN0= +github.com/essentialkaos/ek/v12 v12.58.0/go.mod h1:G8ghiSKh8ToJQCdB2bAhE3CnI6dn9nTJdWH3bQIVr1U= github.com/essentialkaos/go-linenoise/v3 v3.4.0/go.mod h1:t1kNLY2bSMQCy1JXOefD2BDLs/TTPMtTv3DFNV5uDSI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= From 2140ebbbb258ed5e22c20602835d12a3760faf17 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Feb 2023 03:04:42 +0000 Subject: [PATCH 11/23] Bump github.com/essentialkaos/ek/v12 from 12.58.0 to 12.60.0 Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.58.0 to 12.60.0. - [Release notes](https://github.com/essentialkaos/ek/releases) - [Changelog](https://github.com/essentialkaos/ek/blob/master/CHANGELOG.md) - [Commits](https://github.com/essentialkaos/ek/compare/v12.58.0...v12.60.0) --- updated-dependencies: - dependency-name: github.com/essentialkaos/ek/v12 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index be68f9b..195e912 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,6 @@ module github.com/essentialkaos/uc go 1.17 -require github.com/essentialkaos/ek/v12 v12.58.0 +require github.com/essentialkaos/ek/v12 v12.60.0 require golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect diff --git a/go.sum b/go.sum index b48d0a7..3a34119 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/essentialkaos/check v1.3.0 h1:ria+8o22RCLdt2D/1SHQsEH5Mmy5S+iWHaGHrrbPUc0= github.com/essentialkaos/check v1.3.0/go.mod h1:PhxzfJWlf5L/skuyhzBLIvjMB5Xu9TIyDIsqpY5MvB8= -github.com/essentialkaos/ek/v12 v12.58.0 h1:k0HIBV4w0te4Yr/j5apowXvq1tLP3kbmZdyvxP4YkN0= -github.com/essentialkaos/ek/v12 v12.58.0/go.mod h1:G8ghiSKh8ToJQCdB2bAhE3CnI6dn9nTJdWH3bQIVr1U= +github.com/essentialkaos/ek/v12 v12.60.0 h1:Z0wGjnSAyJLHkbhlO27E/GfRqNFD11zPotEha7ygOzg= +github.com/essentialkaos/ek/v12 v12.60.0/go.mod h1:QFEIBoGPE5ezTV08JYWlWLL5t8fwcdOe3/e7bhTJNW0= github.com/essentialkaos/go-linenoise/v3 v3.4.0/go.mod h1:t1kNLY2bSMQCy1JXOefD2BDLs/TTPMtTv3DFNV5uDSI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= From 9bde53eef4534c861cb9cc87258e5952ca50b1b6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Mar 2023 04:02:07 +0000 Subject: [PATCH 12/23] Bump github.com/essentialkaos/ek/v12 from 12.60.0 to 12.60.1 Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.60.0 to 12.60.1. - [Release notes](https://github.com/essentialkaos/ek/releases) - [Changelog](https://github.com/essentialkaos/ek/blob/master/CHANGELOG.md) - [Commits](https://github.com/essentialkaos/ek/compare/v12.60.0...v12.60.1) --- updated-dependencies: - dependency-name: github.com/essentialkaos/ek/v12 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 41 +++++++++++++++++++++++++++++++---------- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 195e912..37f91f3 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,6 @@ module github.com/essentialkaos/uc go 1.17 -require github.com/essentialkaos/ek/v12 v12.60.0 +require github.com/essentialkaos/ek/v12 v12.60.1 -require golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect +require golang.org/x/sys v0.5.0 // indirect diff --git a/go.sum b/go.sum index 3a34119..50671db 100644 --- a/go.sum +++ b/go.sum @@ -1,29 +1,50 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/essentialkaos/check v1.3.0 h1:ria+8o22RCLdt2D/1SHQsEH5Mmy5S+iWHaGHrrbPUc0= github.com/essentialkaos/check v1.3.0/go.mod h1:PhxzfJWlf5L/skuyhzBLIvjMB5Xu9TIyDIsqpY5MvB8= -github.com/essentialkaos/ek/v12 v12.60.0 h1:Z0wGjnSAyJLHkbhlO27E/GfRqNFD11zPotEha7ygOzg= -github.com/essentialkaos/ek/v12 v12.60.0/go.mod h1:QFEIBoGPE5ezTV08JYWlWLL5t8fwcdOe3/e7bhTJNW0= +github.com/essentialkaos/ek/v12 v12.60.1 h1:8soxFFOK5ryGxjrlcc6tAHdeVoCI5paIpXYqh+CTrMQ= +github.com/essentialkaos/ek/v12 v12.60.1/go.mod h1:aDym0Lf/AFZJ37hJhJ+JAw2AeQQAwcYksjSC5lDNWh4= github.com/essentialkaos/go-linenoise/v3 v3.4.0/go.mod h1:t1kNLY2bSMQCy1JXOefD2BDLs/TTPMtTv3DFNV5uDSI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= -golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI= -golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= From 03a46a50fee7467dca315ec3942b4441be33085b Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Mon, 6 Mar 2023 00:13:05 +0300 Subject: [PATCH 13/23] Regenerate Makefile with the latest version of gomakegen --- Makefile | 4 ++-- go.mod | 2 +- uc.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index adf6605..8b219e3 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ ################################################################################ -# This Makefile generated by GoMakeGen 2.1.0 using next command: +# This Makefile generated by GoMakeGen 2.2.0 using next command: # gomakegen --mod . # # More info: https://kaos.sh/gomakegen @@ -94,6 +94,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.1.0\033[0m\n' + @echo -e '\033[90mGenerated by GoMakeGen 2.2.0\033[0m\n' ################################################################################ diff --git a/go.mod b/go.mod index 37f91f3..5719904 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/essentialkaos/uc -go 1.17 +go 1.18 require github.com/essentialkaos/ek/v12 v12.60.1 diff --git a/uc.go b/uc.go index 4393f12..25466f1 100644 --- a/uc.go +++ b/uc.go @@ -2,7 +2,7 @@ package main // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // From 11b6e3a19db897ee97648a53c6b763e5bf798221 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Mon, 6 Mar 2023 00:13:30 +0300 Subject: [PATCH 14/23] Dependencies update --- go.mod | 2 +- go.sum | 46 ++-------------------------------------------- 2 files changed, 3 insertions(+), 45 deletions(-) diff --git a/go.mod b/go.mod index 5719904..8121239 100644 --- a/go.mod +++ b/go.mod @@ -4,4 +4,4 @@ go 1.18 require github.com/essentialkaos/ek/v12 v12.60.1 -require golang.org/x/sys v0.5.0 // indirect +require golang.org/x/sys v0.6.0 // indirect diff --git a/go.sum b/go.sum index 50671db..9b60c24 100644 --- a/go.sum +++ b/go.sum @@ -1,50 +1,8 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/essentialkaos/check v1.3.0 h1:ria+8o22RCLdt2D/1SHQsEH5Mmy5S+iWHaGHrrbPUc0= -github.com/essentialkaos/check v1.3.0/go.mod h1:PhxzfJWlf5L/skuyhzBLIvjMB5Xu9TIyDIsqpY5MvB8= github.com/essentialkaos/ek/v12 v12.60.1 h1:8soxFFOK5ryGxjrlcc6tAHdeVoCI5paIpXYqh+CTrMQ= github.com/essentialkaos/ek/v12 v12.60.1/go.mod h1:aDym0Lf/AFZJ37hJhJ+JAw2AeQQAwcYksjSC5lDNWh4= -github.com/essentialkaos/go-linenoise/v3 v3.4.0/go.mod h1:t1kNLY2bSMQCy1JXOefD2BDLs/TTPMtTv3DFNV5uDSI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= From 901b86843df8d0229596d9f2ef59bc19a0e8830a Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Mon, 6 Mar 2023 00:34:52 +0300 Subject: [PATCH 15/23] Improvements --- .github/ISSUE_TEMPLATE.md | 4 +- .github/workflows/ci.yml | 24 +- README.md | 12 +- cli/cli.go | 460 ++++++++++++++++++++++++++++++++++++++ cli/support/support.go | 166 ++++++++++++++ common/uc.spec | 29 ++- go.mod | 5 +- go.sum | 2 + uc.go | 415 +--------------------------------- 9 files changed, 680 insertions(+), 437 deletions(-) create mode 100644 cli/cli.go create mode 100644 cli/support/support.go diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 0e1478a..0b2bbc4 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -4,9 +4,7 @@ _Before opening an issue, search for similar bug reports or feature requests on **System info:** -* **Version used (`uc -v`):** -* **OS (e.g. from `/etc/*-release`):** -* **Kernel (`uname -a`):** +* **Verbose version info (`uc -vv`):** * **Install tools:** **Steps to reproduce:** diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08be257..f5fd255 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,18 +7,34 @@ on: branches: [master] schedule: - cron: '0 16 */15 * *' + workflow_dispatch: + inputs: + force_run: + description: 'Force workflow run' + required: true + type: choice + options: [yes, no] + +permissions: + actions: read + contents: read + statuses: write + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + SRC_DIR: src/github.com/${{ github.repository }} jobs: Go: name: Go runs-on: ubuntu-latest - env: - SRC_DIR: src/github.com/${{ github.repository }} - strategy: matrix: - go: [ '1.18.x', '1.19.x' ] + go: [ '1.19.x', '1.20.x' ] steps: - name: Set up Go diff --git a/README.md b/README.md index 78fedc5..3e27843 100644 --- a/README.md +++ b/README.md @@ -22,22 +22,16 @@ #### From sources -To build the `uc` from scratch, make sure you have a working Go 1.16+ workspace (_[instructions](https://golang.org/doc/install)_), then: +To build the `uc` from scratch, make sure you have a working Go 1.19+ workspace (_[instructions](https://golang.org/doc/install)_), then: ``` -go get github.com/essentialkaos/uc -``` - -If you want to update `uc` to latest stable release, do: - -``` -go get -u github.com/essentialkaos/uc +go install github.com/essentialkaos/uc@latest ``` #### From [ESSENTIAL KAOS Public Repository](https://yum.kaos.st) ```bash -sudo yum install -y https://yum.kaos.st/get/$(uname -r).rpm +sudo yum install -y https://yum.kaos.st/kaos-repo-latest.el$(grep 'CPE_NAME' /etc/os-release | tr -d '"' | cut -d':' -f5).noarch.rpm sudo yum install uc ``` diff --git a/cli/cli.go b/cli/cli.go new file mode 100644 index 0000000..052642f --- /dev/null +++ b/cli/cli.go @@ -0,0 +1,460 @@ +package cli + +// ////////////////////////////////////////////////////////////////////////////////// // +// // +// Copyright (c) 2023 ESSENTIAL KAOS // +// Apache License, Version 2.0 // +// // +// ////////////////////////////////////////////////////////////////////////////////// // + +import ( + "bufio" + "fmt" + "hash/crc64" + "os" + "runtime" + "sort" + "strconv" + "strings" + "sync" + "time" + + "github.com/essentialkaos/ek/v12/fmtc" + "github.com/essentialkaos/ek/v12/fmtutil" + "github.com/essentialkaos/ek/v12/fsutil" + "github.com/essentialkaos/ek/v12/options" + "github.com/essentialkaos/ek/v12/signal" + "github.com/essentialkaos/ek/v12/strutil" + "github.com/essentialkaos/ek/v12/usage" + "github.com/essentialkaos/ek/v12/usage/completion/bash" + "github.com/essentialkaos/ek/v12/usage/completion/fish" + "github.com/essentialkaos/ek/v12/usage/completion/zsh" + "github.com/essentialkaos/ek/v12/usage/man" + "github.com/essentialkaos/ek/v12/usage/update" + + "github.com/essentialkaos/uc/cli/support" +) + +// ////////////////////////////////////////////////////////////////////////////////// // + +// Application basic info +const ( + APP = "uc" + VER = "1.1.1" + DESC = "Tool for counting unique lines" +) + +// Constants with options names +const ( + OPT_MAX_LINES = "m:max" + OPT_DISTRIBUTION = "d:dist" + OPT_NO_PROGRESS = "np:no-progress" + OPT_NO_COLOR = "nc:no-color" + OPT_HELP = "h:help" + OPT_VER = "v:version" + + OPT_VERB_VER = "vv:verbose-version" + OPT_COMPLETION = "completion" + OPT_GENERATE_MAN = "generate-man" +) + +// ////////////////////////////////////////////////////////////////////////////////// // + +// MAX_SAMPLE_SIZE is maximum sample size +const MAX_SAMPLE_SIZE = 512 + +// ////////////////////////////////////////////////////////////////////////////////// // + +// Stats contains data info +type Stats struct { + Counters map[uint64]uint32 // crc64 → num + Samples map[uint64]string // crc64 → sample (512 symbols) + LastReadLines uint64 + LastReadBytes float64 + TotalReadLines uint64 + TotalReadBytes float64 + LastReadDate time.Time + Finished bool + + mx *sync.Mutex +} + +// ////////////////////////////////////////////////////////////////////////////////// // + +// LineInfo is struct with line info +type LineInfo struct { + CRC uint64 + Num uint32 +} + +type linesSlice []LineInfo + +func (s linesSlice) Len() int { return len(s) } +func (s linesSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s linesSlice) Less(i, j int) bool { + return s[i].Num < s[j].Num +} + +// ////////////////////////////////////////////////////////////////////////////////// // + +// optMap is map with options +var optMap = options.Map{ + OPT_MAX_LINES: {Type: options.INT}, + OPT_DISTRIBUTION: {Type: options.BOOL}, + OPT_NO_PROGRESS: {Type: options.BOOL}, + OPT_NO_COLOR: {Type: options.BOOL}, + OPT_HELP: {Type: options.BOOL, Alias: "u:usage"}, + OPT_VER: {Type: options.BOOL, Alias: "ver"}, + + OPT_VERB_VER: {Type: options.BOOL}, + OPT_COMPLETION: {}, + OPT_GENERATE_MAN: {Type: options.BOOL}, +} + +// stats contains info about data +var stats *Stats + +// rawMode is raw mode flag +var rawMode bool + +// ////////////////////////////////////////////////////////////////////////////////// // + +// Init is main function +func Init(gitRev string, gomod []byte) { + runtime.GOMAXPROCS(1) + preConfigureUI() + + args, errs := options.Parse(optMap) + + if len(errs) != 0 { + printError("Options parsing errors:") + + for _, err := range errs { + printError(" %v", err) + } + + os.Exit(1) + } + + configureUI() + + switch { + case options.Has(OPT_COMPLETION): + os.Exit(genCompletion()) + case options.Has(OPT_GENERATE_MAN): + os.Exit(genMan()) + case options.GetB(OPT_VER): + showAbout(gitRev) + os.Exit(0) + case options.GetB(OPT_VERB_VER): + support.ShowSupportInfo(APP, VER, gitRev, gomod) + os.Exit(0) + case options.GetB(OPT_HELP) || len(args) == 0: + showUsage() + os.Exit(0) + } + + signal.Handlers{ + signal.INT: signalHandler, + signal.TERM: signalHandler, + signal.QUIT: signalHandler, + }.TrackAsync() + + processData(args.Get(0).String()) +} + +// 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") == "" { + fmtc.DisableColors = true + rawMode = true + } + + if os.Getenv("NO_COLOR") != "" { + fmtc.DisableColors = true + } +} + +// configureUI configures user interface +func configureUI() { + if options.GetB(OPT_NO_COLOR) { + fmtc.DisableColors = true + } + + if options.GetB(OPT_NO_PROGRESS) { + rawMode = true + } +} + +// processData starts data processing +func processData(input string) { + var r *bufio.Reader + + stats = &Stats{ + Counters: make(map[uint64]uint32), + mx: &sync.Mutex{}, + } + + if input == "-" { + r = bufio.NewReader(os.Stdin) + } else { + fd, err := os.OpenFile(input, os.O_RDONLY, 0) + + if err != nil { + printError(err.Error()) + os.Exit(1) + } + + r = bufio.NewReader(fd) + } + + readData(bufio.NewScanner(r)) +} + +// readData reads data +func readData(s *bufio.Scanner) { + ct := crc64.MakeTable(crc64.ECMA) + dist := options.GetB(OPT_DISTRIBUTION) + maxLines, err := parseMaxLines(options.GetS(OPT_MAX_LINES)) + + if err != nil { + printError(err.Error()) + os.Exit(1) + } + + if dist { + stats.Samples = make(map[uint64]string) + } + + stats.LastReadDate = time.Now() + + if !rawMode { + go printProgress() + } + + for s.Scan() { + data := s.Bytes() + dataLen := float64(len(data)) + dataCrc := crc64.Checksum(data, ct) + + stats.mx.Lock() + + stats.Counters[dataCrc]++ + stats.LastReadBytes += dataLen + stats.LastReadLines++ + + stats.TotalReadLines++ + stats.TotalReadBytes += dataLen + + if dist { + _, exist := stats.Samples[dataCrc] + + if !exist { + stats.Samples[dataCrc] = strutil.Substr(string(data), 0, MAX_SAMPLE_SIZE) + } + } + + if maxLines > 0 && len(stats.Counters) == maxLines { + stats.mx.Unlock() + break + } + + stats.mx.Unlock() + } + + printResults() +} + +// printProgress shows data processing progress +func printProgress() { + for range time.NewTicker(time.Second / 4).C { + stats.mx.Lock() + + if stats.Finished { + break + } + + now := time.Now() + dur := now.Sub(stats.LastReadDate) + readSpeed := stats.LastReadBytes / dur.Seconds() + + fmtc.TPrintf( + "{s}%12s/s {s-}|{s} %-12s {s-}|{s} %12s/s {s-}|{s} %-12s{!}", + fmtutil.PrettyNum(stats.LastReadLines), + fmtutil.PrettyNum(stats.TotalReadLines), + fmtutil.PrettySize(readSpeed), + fmtutil.PrettySize(stats.TotalReadBytes), + ) + + stats.LastReadLines = 0 + stats.LastReadBytes = 0 + stats.LastReadDate = now + + stats.mx.Unlock() + } +} + +// printResults shows results +func printResults() { + stats.mx.Lock() + + stats.Finished = true + + if options.GetB(OPT_DISTRIBUTION) { + printDistribution() + } else { + fmtc.TPrintln(len(stats.Counters)) + } + + stats.mx.Unlock() +} + +// printDistribution prints distrubution info +func printDistribution() { + var distData linesSlice + + for crc, num := range stats.Counters { + distData = append(distData, LineInfo{crc, num}) + } + + sort.Sort(sort.Reverse(distData)) + + for _, info := range distData { + fmtc.TPrintf(" %7d %s\n", info.Num, stats.Samples[info.CRC]) + } +} + +// parseMaxLines parses max line option +func parseMaxLines(maxLines string) (int, error) { + if maxLines == "" { + return 0, nil + } + + maxLines = strings.ToUpper(maxLines) + + mp := 1 + + switch { + case strings.HasSuffix(maxLines, "K"): + maxLines = strutil.Exclude(maxLines, "K") + mp = 1000 + case strings.HasSuffix(maxLines, "M"): + mp = 1000 * 1000 + maxLines = strutil.Exclude(maxLines, "M") + } + + num, err := strconv.Atoi(maxLines) + + if err != nil { + return 0, err + } + + return num * mp, nil +} + +// signalHandler is signal handler +func signalHandler() { + printResults() + os.Exit(0) +} + +// printError prints error message to console +func printError(f string, a ...interface{}) { + fmtc.Fprintf(os.Stderr, "{r}"+f+"{!}\n", a...) +} + +// ////////////////////////////////////////////////////////////////////////////////// // + +// showUsage prints usage info +func showUsage() { + genUsage().Render() +} + +// showAbout prints info about version +func showAbout(gitRev string) { + genAbout(gitRev).Render() +} + +// genCompletion generates completion for different shells +func genCompletion() int { + switch options.GetS(OPT_COMPLETION) { + case "bash": + fmt.Printf(bash.Generate(genUsage(), APP)) + case "fish": + fmt.Printf(fish.Generate(genUsage(), APP)) + case "zsh": + fmt.Printf(zsh.Generate(genUsage(), optMap, APP)) + default: + return 1 + } + + return 0 +} + +// genMan generates man page +func genMan() int { + fmt.Println( + man.Generate( + genUsage(), + genAbout(""), + ), + ) + + return 0 +} + +// genUsage generates usage info +func genUsage() *usage.Info { + info := usage.NewInfo(APP, "file") + + info.AddOption(OPT_DISTRIBUTION, "Show number of occurrences for every line") + info.AddOption(OPT_MAX_LINES, "Max number of unique lines", "num") + info.AddOption(OPT_NO_PROGRESS, "Disable progress output") + info.AddOption(OPT_NO_PROGRESS, "Disable progress output") + info.AddOption(OPT_NO_COLOR, "Disable colors in output") + info.AddOption(OPT_HELP, "Show this help message") + info.AddOption(OPT_VER, "Show version") + + info.AddExample("file.txt", "Count unique lines in file.txt") + info.AddExample("-d file.txt", "Show distribution for file.txt") + info.AddExample("-d -m 5k file.txt", "Show distribution for file.txt with 5,000 uniq lines max") + info.AddRawExample( + "cat file.txt | "+APP+" -", + "Count unique lines in stdin data", + ) + + return 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 ", + BugTracker: "https://github.com/essentialkaos/uc", + UpdateChecker: usage.UpdateChecker{"essentialkaos/uc", update.GitHubChecker}, + } + + if gitRev != "" { + about.Build = "git:" + gitRev + } + + return about +} diff --git a/cli/support/support.go b/cli/support/support.go new file mode 100644 index 0000000..6fb1347 --- /dev/null +++ b/cli/support/support.go @@ -0,0 +1,166 @@ +package support + +// ////////////////////////////////////////////////////////////////////////////////// // +// // +// Copyright (c) 2023 ESSENTIAL KAOS // +// Apache License, Version 2.0 // +// // +// ////////////////////////////////////////////////////////////////////////////////// // + +import ( + "fmt" + "os" + "runtime" + "strings" + + "github.com/essentialkaos/ek/v12/fmtc" + "github.com/essentialkaos/ek/v12/fmtutil" + "github.com/essentialkaos/ek/v12/fsutil" + "github.com/essentialkaos/ek/v12/hash" + "github.com/essentialkaos/ek/v12/strutil" + "github.com/essentialkaos/ek/v12/system" + + "github.com/essentialkaos/depsy" +) + +// ////////////////////////////////////////////////////////////////////////////////// // + +// ShowSupportInfo prints verbose info about application, system, dependencies and +// important environment +func ShowSupportInfo(app, ver, gitRev string, gomod []byte) { + fmtutil.SeparatorTitleColorTag = "{s-}" + fmtutil.SeparatorFullscreen = false + fmtutil.SeparatorColorTag = "{s-}" + fmtutil.SeparatorSize = 80 + + showApplicationInfo(app, ver, gitRev) + showOSInfo() + showDepsInfo(gomod) + + fmtutil.Separator(false) +} + +// ////////////////////////////////////////////////////////////////////////////////// // + +// showApplicationInfo shows verbose information about application +func showApplicationInfo(app, ver, gitRev string) { + fmtutil.Separator(false, "APPLICATION INFO") + + printInfo(7, "Name", app) + printInfo(7, "Version", ver) + + printInfo(7, "Go", fmtc.Sprintf( + "%s {s}(%s/%s){!}", + strings.TrimLeft(runtime.Version(), "go"), + runtime.GOOS, runtime.GOARCH, + )) + + if gitRev != "" { + if !fmtc.DisableColors && fmtc.IsTrueColorSupported() { + printInfo(7, "Git SHA", gitRev+getHashColorBullet(gitRev)) + } else { + printInfo(7, "Git SHA", gitRev) + } + } + + bin, _ := os.Executable() + binSHA := hash.FileHash(bin) + + if binSHA != "" { + binSHA = strutil.Head(binSHA, 7) + if !fmtc.DisableColors && fmtc.IsTrueColorSupported() { + printInfo(7, "Bin SHA", binSHA+getHashColorBullet(binSHA)) + } else { + printInfo(7, "Bin SHA", binSHA) + } + } +} + +// showOSInfo shows verbose information about system +func showOSInfo() { + osInfo, err := system.GetOSInfo() + + if err == nil { + fmtutil.Separator(false, "OS INFO") + + printInfo(12, "Name", osInfo.Name) + printInfo(12, "Pretty Name", osInfo.PrettyName) + printInfo(12, "Version", osInfo.VersionID) + printInfo(12, "ID", osInfo.ID) + printInfo(12, "ID Like", osInfo.IDLike) + printInfo(12, "Version ID", osInfo.VersionID) + printInfo(12, "Version Code", osInfo.VersionCodename) + printInfo(12, "CPE", osInfo.CPEName) + } + + systemInfo, err := system.GetSystemInfo() + + if err != nil { + return + } else { + if osInfo == nil { + fmtutil.Separator(false, "SYSTEM INFO") + printInfo(12, "Name", systemInfo.OS) + } + } + + printInfo(12, "Arch", systemInfo.Arch) + printInfo(12, "Kernel", systemInfo.Kernel) + + containerEngine := "No" + + switch { + case fsutil.IsExist("/.dockerenv"): + containerEngine = "Yes (Docker)" + case fsutil.IsExist("/run/.containerenv"): + containerEngine = "Yes (Podman)" + } + + fmtc.NewLine() + + printInfo(12, "Container", containerEngine) +} + +// showDepsInfo shows information about all dependencies +func showDepsInfo(gomod []byte) { + deps := depsy.Extract(gomod, false) + + if len(deps) == 0 { + return + } + + fmtutil.Separator(false, "DEPENDENCIES") + + for _, dep := range deps { + if dep.Extra == "" { + fmtc.Printf(" {s}%8s{!} %s\n", dep.Version, dep.Path) + } else { + fmtc.Printf(" {s}%8s{!} %s {s-}(%s){!}\n", dep.Version, dep.Path, dep.Extra) + } + } +} + +// getHashColorBullet return bullet with color from hash +func getHashColorBullet(v string) string { + if len(v) > 6 { + v = strutil.Head(v, 6) + } + + return fmtc.Sprintf(" {#" + strutil.Head(v, 6) + "}● {!}") +} + +// printInfo formats and prints info record +func printInfo(size int, name, value string) { + name = name + ":" + size++ + + if value == "" { + fm := fmt.Sprintf(" {*}%%-%ds{!} {s-}—{!}\n", size) + fmtc.Printf(fm, name) + } else { + fm := fmt.Sprintf(" {*}%%-%ds{!} %%s\n", size) + fmtc.Printf(fm, name, value) + } +} + +// ////////////////////////////////////////////////////////////////////////////////// // diff --git a/common/uc.spec b/common/uc.spec index 7d14389..36e55cf 100644 --- a/common/uc.spec +++ b/common/uc.spec @@ -1,24 +1,24 @@ ################################################################################ -%define debug_package %{nil} +%define debug_package %{nil} ################################################################################ -Summary: Simple utility for counting unique lines -Name: uc -Version: 1.1.0 -Release: 1%{?dist} -Group: Applications/System -License: Apache License, Version 2.0 -URL: https://kaos.sh/uc +Summary: Simple utility for counting unique lines +Name: uc +Version: 1.1.1 +Release: 0%{?dist} +Group: Applications/System +License: Apache License, Version 2.0 +URL: https://kaos.sh/uc -Source0: https://source.kaos.st/%{name}/%{name}-%{version}.tar.bz2 +Source0: https://source.kaos.st/%{name}/%{name}-%{version}.tar.bz2 -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: golang >= 1.19 +BuildRequires: golang >= 1.19 -Provides: %{name} = %{version}-%{release} +Provides: %{name} = %{version}-%{release} ################################################################################ @@ -65,6 +65,11 @@ rm -rf %{buildroot} ################################################################################ %changelog +* Mon Mar 06 2023 Anton Novojilov - 1.1.1-0 +- Added verbose info output +- Dependencies update +- Code refactoring + * Thu Dec 01 2022 Anton Novojilov - 1.1.0-1 - Fixed build using sources from source.kaos.st diff --git a/go.mod b/go.mod index 8121239..419b446 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,9 @@ module github.com/essentialkaos/uc go 1.18 -require github.com/essentialkaos/ek/v12 v12.60.1 +require ( + github.com/essentialkaos/depsy v1.0.0 + github.com/essentialkaos/ek/v12 v12.60.1 +) require golang.org/x/sys v0.6.0 // indirect diff --git a/go.sum b/go.sum index 9b60c24..bed923c 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,6 @@ github.com/essentialkaos/check v1.3.0 h1:ria+8o22RCLdt2D/1SHQsEH5Mmy5S+iWHaGHrrbPUc0= +github.com/essentialkaos/depsy v1.0.0 h1:FikBtTnNhk+xFO/hFr+CfiKs6QnA3wMD6tGL0XTEUkc= +github.com/essentialkaos/depsy v1.0.0/go.mod h1:XVsB2eVUonEzmLKQP3ig2P6v2+WcHVgJ10zm0JLqFMM= github.com/essentialkaos/ek/v12 v12.60.1 h1:8soxFFOK5ryGxjrlcc6tAHdeVoCI5paIpXYqh+CTrMQ= github.com/essentialkaos/ek/v12 v12.60.1/go.mod h1:aDym0Lf/AFZJ37hJhJ+JAw2AeQQAwcYksjSC5lDNWh4= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= diff --git a/uc.go b/uc.go index 25466f1..3db46cf 100644 --- a/uc.go +++ b/uc.go @@ -8,422 +8,21 @@ package main // ////////////////////////////////////////////////////////////////////////////////// // import ( - "bufio" - "fmt" - "hash/crc64" - "os" - "runtime" - "sort" - "strconv" - "strings" - "sync" - "time" + _ "embed" - "github.com/essentialkaos/ek/v12/fmtc" - "github.com/essentialkaos/ek/v12/fmtutil" - "github.com/essentialkaos/ek/v12/fsutil" - "github.com/essentialkaos/ek/v12/options" - "github.com/essentialkaos/ek/v12/signal" - "github.com/essentialkaos/ek/v12/strutil" - "github.com/essentialkaos/ek/v12/usage" - "github.com/essentialkaos/ek/v12/usage/completion/bash" - "github.com/essentialkaos/ek/v12/usage/completion/fish" - "github.com/essentialkaos/ek/v12/usage/completion/zsh" - "github.com/essentialkaos/ek/v12/usage/man" - "github.com/essentialkaos/ek/v12/usage/update" + CLI "github.com/essentialkaos/uc/cli" ) // ////////////////////////////////////////////////////////////////////////////////// // -// Application basic info -const ( - APP = "uc" - VER = "1.1.0" - DESC = "Tool for counting unique lines" -) - -// Constants with options names -const ( - OPT_MAX_LINES = "m:max" - OPT_DISTRIBUTION = "d:dist" - OPT_NO_PROGRESS = "np:no-progress" - OPT_NO_COLOR = "nc:no-color" - OPT_HELP = "h:help" - OPT_VER = "v:version" - - OPT_COMPLETION = "completion" - OPT_GENERATE_MAN = "generate-man" -) - -// ////////////////////////////////////////////////////////////////////////////////// // - -// MAX_SAMPLE_SIZE is maximum sample size -const MAX_SAMPLE_SIZE = 512 - -// ////////////////////////////////////////////////////////////////////////////////// // - -// Stats contains data info -type Stats struct { - Counters map[uint64]uint32 // crc64 → num - Samples map[uint64]string // crc64 → sample (512 symbols) - LastReadLines uint64 - LastReadBytes float64 - TotalReadLines uint64 - TotalReadBytes float64 - LastReadDate time.Time - Finished bool - - mx *sync.Mutex -} - -// ////////////////////////////////////////////////////////////////////////////////// // +//go:embed go.mod +var gomod []byte -// LineInfo is struct with line info -type LineInfo struct { - CRC uint64 - Num uint32 -} - -type linesSlice []LineInfo - -func (s linesSlice) Len() int { return len(s) } -func (s linesSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -func (s linesSlice) Less(i, j int) bool { - return s[i].Num < s[j].Num -} - -// ////////////////////////////////////////////////////////////////////////////////// // - -// optMap is map with options -var optMap = options.Map{ - OPT_MAX_LINES: {Type: options.INT}, - OPT_DISTRIBUTION: {Type: options.BOOL}, - OPT_NO_PROGRESS: {Type: options.BOOL}, - OPT_NO_COLOR: {Type: options.BOOL}, - OPT_HELP: {Type: options.BOOL, Alias: "u:usage"}, - OPT_VER: {Type: options.BOOL, Alias: "ver"}, - - OPT_COMPLETION: {}, - OPT_GENERATE_MAN: {Type: options.BOOL}, -} - -// stats contains info about data -var stats *Stats - -// rawMode is raw mode flag -var rawMode bool +// gitrev is short hash of the latest git commit +var gitrev string // ////////////////////////////////////////////////////////////////////////////////// // -// main is main func func main() { - runtime.GOMAXPROCS(1) - - args, errs := options.Parse(optMap) - - if len(errs) != 0 { - printError("Options parsing errors:") - - for _, err := range errs { - printError(" %v", err) - } - - os.Exit(1) - } - - if options.Has(OPT_COMPLETION) { - os.Exit(genCompletion()) - } - - if options.Has(OPT_GENERATE_MAN) { - genMan() - os.Exit(0) - } - - configureUI() - - if options.GetB(OPT_VER) { - showAbout() - os.Exit(0) - } - - if options.GetB(OPT_HELP) || len(args) == 0 { - showUsage() - os.Exit(0) - } - - signal.Handlers{ - signal.INT: signalHandler, - signal.TERM: signalHandler, - signal.QUIT: signalHandler, - }.TrackAsync() - - processData(args.Get(0).String()) -} - -// configureUI configures user interface -func configureUI() { - if options.GetB(OPT_NO_COLOR) { - fmtc.DisableColors = true - } - - if !fsutil.IsCharacterDevice("/dev/stdout") && os.Getenv("FAKETTY") == "" { - rawMode = true - } - - if options.GetB(OPT_NO_PROGRESS) { - rawMode = true - } -} - -// processData starts data processing -func processData(input string) { - var r *bufio.Reader - - stats = &Stats{ - Counters: make(map[uint64]uint32), - mx: &sync.Mutex{}, - } - - if input == "-" { - r = bufio.NewReader(os.Stdin) - } else { - fd, err := os.OpenFile(input, os.O_RDONLY, 0) - - if err != nil { - printError(err.Error()) - os.Exit(1) - } - - r = bufio.NewReader(fd) - } - - readData(bufio.NewScanner(r)) -} - -// readData reads data -func readData(s *bufio.Scanner) { - ct := crc64.MakeTable(crc64.ECMA) - dist := options.GetB(OPT_DISTRIBUTION) - maxLines, err := parseMaxLines(options.GetS(OPT_MAX_LINES)) - - if err != nil { - printError(err.Error()) - os.Exit(1) - } - - if dist { - stats.Samples = make(map[uint64]string) - } - - stats.LastReadDate = time.Now() - - if !rawMode { - go printProgress() - } - - for s.Scan() { - data := s.Bytes() - dataLen := float64(len(data)) - dataCrc := crc64.Checksum(data, ct) - - stats.mx.Lock() - - stats.Counters[dataCrc]++ - stats.LastReadBytes += dataLen - stats.LastReadLines++ - - stats.TotalReadLines++ - stats.TotalReadBytes += dataLen - - if dist { - _, exist := stats.Samples[dataCrc] - - if !exist { - stats.Samples[dataCrc] = strutil.Substr(string(data), 0, MAX_SAMPLE_SIZE) - } - } - - if maxLines > 0 && len(stats.Counters) == maxLines { - stats.mx.Unlock() - break - } - - stats.mx.Unlock() - } - - printResults() -} - -// printProgress shows data processing progress -func printProgress() { - for range time.NewTicker(time.Second / 4).C { - stats.mx.Lock() - - if stats.Finished { - break - } - - now := time.Now() - dur := now.Sub(stats.LastReadDate) - readSpeed := stats.LastReadBytes / dur.Seconds() - - fmtc.TPrintf( - "{s}%12s/s {s-}|{s} %-12s {s-}|{s} %12s/s {s-}|{s} %-12s{!}", - fmtutil.PrettyNum(stats.LastReadLines), - fmtutil.PrettyNum(stats.TotalReadLines), - fmtutil.PrettySize(readSpeed), - fmtutil.PrettySize(stats.TotalReadBytes), - ) - - stats.LastReadLines = 0 - stats.LastReadBytes = 0 - stats.LastReadDate = now - - stats.mx.Unlock() - } -} - -// printResults shows results -func printResults() { - stats.mx.Lock() - - stats.Finished = true - - if options.GetB(OPT_DISTRIBUTION) { - printDistribution() - } else { - fmtc.TPrintln(len(stats.Counters)) - } - - stats.mx.Unlock() -} - -// printDistribution prints distrubution info -func printDistribution() { - var distData linesSlice - - for crc, num := range stats.Counters { - distData = append(distData, LineInfo{crc, num}) - } - - sort.Sort(sort.Reverse(distData)) - - for _, info := range distData { - fmtc.TPrintf(" %7d %s\n", info.Num, stats.Samples[info.CRC]) - } -} - -// parseMaxLines parses max line option -func parseMaxLines(maxLines string) (int, error) { - if maxLines == "" { - return 0, nil - } - - maxLines = strings.ToUpper(maxLines) - - mp := 1 - - switch { - case strings.HasSuffix(maxLines, "K"): - maxLines = strutil.Exclude(maxLines, "K") - mp = 1000 - case strings.HasSuffix(maxLines, "M"): - mp = 1000 * 1000 - maxLines = strutil.Exclude(maxLines, "M") - } - - num, err := strconv.Atoi(maxLines) - - if err != nil { - return 0, err - } - - return num * mp, nil -} - -// signalHandler is signal handler -func signalHandler() { - printResults() - os.Exit(0) -} - -// printError prints error message to console -func printError(f string, a ...interface{}) { - fmtc.Fprintf(os.Stderr, "{r}"+f+"{!}\n", a...) -} - -// ////////////////////////////////////////////////////////////////////////////////// // - -// showUsage prints usage info -func showUsage() { - genUsage().Render() -} - -// showAbout prints info about version -func showAbout() { - genAbout().Render() -} - -// genCompletion generates completion for different shells -func genCompletion() int { - switch options.GetS(OPT_COMPLETION) { - case "bash": - fmt.Printf(bash.Generate(genUsage(), APP)) - case "fish": - fmt.Printf(fish.Generate(genUsage(), APP)) - case "zsh": - fmt.Printf(zsh.Generate(genUsage(), optMap, APP)) - default: - return 1 - } - - return 0 -} - -// genMan generates man page -func genMan() { - fmt.Println( - man.Generate( - genUsage(), - genAbout(), - ), - ) -} - -// genUsage generates usage info -func genUsage() *usage.Info { - info := usage.NewInfo(APP, "file") - - info.AddOption(OPT_DISTRIBUTION, "Show number of occurrences for every line") - info.AddOption(OPT_MAX_LINES, "Max number of unique lines", "num") - info.AddOption(OPT_NO_PROGRESS, "Disable progress output") - info.AddOption(OPT_NO_PROGRESS, "Disable progress output") - info.AddOption(OPT_NO_COLOR, "Disable colors in output") - info.AddOption(OPT_HELP, "Show this help message") - info.AddOption(OPT_VER, "Show version") - - info.AddExample("file.txt", "Count unique lines in file.txt") - info.AddExample("-d file.txt", "Show distribution for file.txt") - info.AddExample("-d -m 5k file.txt", "Show distribution for file.txt with 5,000 uniq lines max") - info.AddRawExample( - "cat file.txt | "+APP+" -", - "Count unique lines in stdin data", - ) - - return info -} - -// genAbout generates info about version -func genAbout() *usage.About { - return &usage.About{ - App: APP, - Version: VER, - Desc: DESC, - Year: 2009, - Owner: "ESSENTIAL KAOS", - License: "Apache License, Version 2.0 ", - BugTracker: "https://github.com/essentialkaos/uc", - UpdateChecker: usage.UpdateChecker{"essentialkaos/uc", update.GitHubChecker}, - } + CLI.Init(gitrev, gomod) } From 56e9d6bf6097a198be2b7056667c48d2d83e9b5c Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 8 Mar 2023 00:58:13 +0300 Subject: [PATCH 16/23] Code refactoring --- cli/cli.go | 2 +- cli/support/support.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index 052642f..a17b4ff 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -147,7 +147,7 @@ func Init(gitRev string, gomod []byte) { showAbout(gitRev) os.Exit(0) case options.GetB(OPT_VERB_VER): - support.ShowSupportInfo(APP, VER, gitRev, gomod) + support.Print(APP, VER, gitRev, gomod) os.Exit(0) case options.GetB(OPT_HELP) || len(args) == 0: showUsage() diff --git a/cli/support/support.go b/cli/support/support.go index 6fb1347..c5d80fd 100644 --- a/cli/support/support.go +++ b/cli/support/support.go @@ -25,9 +25,9 @@ import ( // ////////////////////////////////////////////////////////////////////////////////// // -// ShowSupportInfo prints verbose info about application, system, dependencies and +// Print prints verbose info about application, system, dependencies and // important environment -func ShowSupportInfo(app, ver, gitRev string, gomod []byte) { +func Print(app, ver, gitRev string, gomod []byte) { fmtutil.SeparatorTitleColorTag = "{s-}" fmtutil.SeparatorFullscreen = false fmtutil.SeparatorColorTag = "{s-}" From 618ef2ff1b5a5d70007e244fd491b82e9db8e6b4 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 8 Mar 2023 00:59:00 +0300 Subject: [PATCH 17/23] Code refactoring --- cli/cli.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index a17b4ff..704b099 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -103,8 +103,8 @@ var optMap = options.Map{ OPT_DISTRIBUTION: {Type: options.BOOL}, OPT_NO_PROGRESS: {Type: options.BOOL}, OPT_NO_COLOR: {Type: options.BOOL}, - OPT_HELP: {Type: options.BOOL, Alias: "u:usage"}, - OPT_VER: {Type: options.BOOL, Alias: "ver"}, + OPT_HELP: {Type: options.BOOL}, + OPT_VER: {Type: options.BOOL}, OPT_VERB_VER: {Type: options.BOOL}, OPT_COMPLETION: {}, From bcd98a2d54e5d5bbcf5789c3d7fbba721c8467b4 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 8 Mar 2023 22:19:04 +0300 Subject: [PATCH 18/23] Improvements --- cli/cli.go | 9 +++++---- go.mod | 2 +- go.sum | 6 +++--- uc.go | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index 704b099..4809cc4 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -119,9 +119,10 @@ var rawMode bool // ////////////////////////////////////////////////////////////////////////////////// // -// Init is main function -func Init(gitRev string, gomod []byte) { +// Run is main application function +func Run(gitRev string, gomod []byte) { runtime.GOMAXPROCS(1) + preConfigureUI() args, errs := options.Parse(optMap) @@ -380,12 +381,12 @@ func printError(f string, a ...interface{}) { // showUsage prints usage info func showUsage() { - genUsage().Render() + genUsage().Print() } // showAbout prints info about version func showAbout(gitRev string) { - genAbout(gitRev).Render() + genAbout(gitRev).Print() } // genCompletion generates completion for different shells diff --git a/go.mod b/go.mod index 419b446..d519b7b 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/essentialkaos/depsy v1.0.0 - github.com/essentialkaos/ek/v12 v12.60.1 + github.com/essentialkaos/ek/v12 v12.61.0 ) require golang.org/x/sys v0.6.0 // indirect diff --git a/go.sum b/go.sum index bed923c..c469d0e 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ -github.com/essentialkaos/check v1.3.0 h1:ria+8o22RCLdt2D/1SHQsEH5Mmy5S+iWHaGHrrbPUc0= +github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1nkuKk= github.com/essentialkaos/depsy v1.0.0 h1:FikBtTnNhk+xFO/hFr+CfiKs6QnA3wMD6tGL0XTEUkc= github.com/essentialkaos/depsy v1.0.0/go.mod h1:XVsB2eVUonEzmLKQP3ig2P6v2+WcHVgJ10zm0JLqFMM= -github.com/essentialkaos/ek/v12 v12.60.1 h1:8soxFFOK5ryGxjrlcc6tAHdeVoCI5paIpXYqh+CTrMQ= -github.com/essentialkaos/ek/v12 v12.60.1/go.mod h1:aDym0Lf/AFZJ37hJhJ+JAw2AeQQAwcYksjSC5lDNWh4= +github.com/essentialkaos/ek/v12 v12.61.0 h1:8cmtVy/0FqUuWJVQNTnaeFxpQSiPWAxPc6j2EIUAEpA= +github.com/essentialkaos/ek/v12 v12.61.0/go.mod h1:9MlSuHpewu7OZ9tM9dLFHvoA8dflBIUPCA0Ctt97wRs= 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.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= diff --git a/uc.go b/uc.go index 3db46cf..d08f46b 100644 --- a/uc.go +++ b/uc.go @@ -24,5 +24,5 @@ var gitrev string // ////////////////////////////////////////////////////////////////////////////////// // func main() { - CLI.Init(gitrev, gomod) + CLI.Run(gitrev, gomod) } From 24bd42efdfc98fb9304f0b9800d3b6d67cea75dc Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 8 Mar 2023 22:50:22 +0300 Subject: [PATCH 19/23] Code refactoring --- cli/cli.go | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index 4809cc4..5284c8d 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -141,17 +141,18 @@ func Run(gitRev string, gomod []byte) { switch { case options.Has(OPT_COMPLETION): - os.Exit(genCompletion()) + os.Exit(printCompletion()) case options.Has(OPT_GENERATE_MAN): - os.Exit(genMan()) + printMan() + os.Exit(0) case options.GetB(OPT_VER): - showAbout(gitRev) + genAbout(gitRev).Print() os.Exit(0) case options.GetB(OPT_VERB_VER): support.Print(APP, VER, gitRev, gomod) os.Exit(0) case options.GetB(OPT_HELP) || len(args) == 0: - showUsage() + genUsage().Print() os.Exit(0) } @@ -379,18 +380,8 @@ func printError(f string, a ...interface{}) { // ////////////////////////////////////////////////////////////////////////////////// // -// showUsage prints usage info -func showUsage() { - genUsage().Print() -} - -// showAbout prints info about version -func showAbout(gitRev string) { - genAbout(gitRev).Print() -} - -// genCompletion generates completion for different shells -func genCompletion() int { +// printCompletion prints completion for given shell +func printCompletion() int { switch options.GetS(OPT_COMPLETION) { case "bash": fmt.Printf(bash.Generate(genUsage(), APP)) @@ -405,16 +396,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 From 17e01666b9cd39ca8917dec4b1d059c9a809110d Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 8 Mar 2023 22:55:29 +0300 Subject: [PATCH 20/23] Code refactoring --- cli/cli.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index 5284c8d..20e137e 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -128,12 +128,7 @@ func Run(gitRev string, gomod []byte) { args, errs := options.Parse(optMap) if len(errs) != 0 { - printError("Options parsing errors:") - - for _, err := range errs { - printError(" %v", err) - } - + printError(errs[0].Error()) os.Exit(1) } From c45c8bd5f6e8ded06ef0ccc58bedd6728eb31fe5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Mar 2023 04:01:11 +0000 Subject: [PATCH 21/23] Bump github.com/essentialkaos/ek/v12 from 12.61.0 to 12.62.0 Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.61.0 to 12.62.0. - [Release notes](https://github.com/essentialkaos/ek/releases) - [Changelog](https://github.com/essentialkaos/ek/blob/master/CHANGELOG.md) - [Commits](https://github.com/essentialkaos/ek/compare/v12.61.0...v12.62.0) --- updated-dependencies: - dependency-name: github.com/essentialkaos/ek/v12 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d519b7b..701c86e 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/essentialkaos/depsy v1.0.0 - github.com/essentialkaos/ek/v12 v12.61.0 + github.com/essentialkaos/ek/v12 v12.62.0 ) require golang.org/x/sys v0.6.0 // indirect diff --git a/go.sum b/go.sum index c469d0e..6b648f7 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1nkuKk= github.com/essentialkaos/depsy v1.0.0 h1:FikBtTnNhk+xFO/hFr+CfiKs6QnA3wMD6tGL0XTEUkc= github.com/essentialkaos/depsy v1.0.0/go.mod h1:XVsB2eVUonEzmLKQP3ig2P6v2+WcHVgJ10zm0JLqFMM= -github.com/essentialkaos/ek/v12 v12.61.0 h1:8cmtVy/0FqUuWJVQNTnaeFxpQSiPWAxPc6j2EIUAEpA= -github.com/essentialkaos/ek/v12 v12.61.0/go.mod h1:9MlSuHpewu7OZ9tM9dLFHvoA8dflBIUPCA0Ctt97wRs= +github.com/essentialkaos/ek/v12 v12.62.0 h1:A+pnMGbSz2apjEjlHU3EQ6Uqam85GTryVPhzcLfY8o4= +github.com/essentialkaos/ek/v12 v12.62.0/go.mod h1:9MlSuHpewu7OZ9tM9dLFHvoA8dflBIUPCA0Ctt97wRs= 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.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= From 650c6fe58eef7dccc5223aedcc0d31b65d0b41ec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Mar 2023 04:00:08 +0000 Subject: [PATCH 22/23] Bump github.com/essentialkaos/ek/v12 from 12.62.0 to 12.63.0 Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.62.0 to 12.63.0. - [Release notes](https://github.com/essentialkaos/ek/releases) - [Changelog](https://github.com/essentialkaos/ek/blob/master/CHANGELOG.md) - [Commits](https://github.com/essentialkaos/ek/compare/v12.62.0...v12.63.0) --- updated-dependencies: - dependency-name: github.com/essentialkaos/ek/v12 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 701c86e..8cc5b90 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/essentialkaos/depsy v1.0.0 - github.com/essentialkaos/ek/v12 v12.62.0 + github.com/essentialkaos/ek/v12 v12.63.0 ) require golang.org/x/sys v0.6.0 // indirect diff --git a/go.sum b/go.sum index 6b648f7..a0cb15a 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1nkuKk= github.com/essentialkaos/depsy v1.0.0 h1:FikBtTnNhk+xFO/hFr+CfiKs6QnA3wMD6tGL0XTEUkc= github.com/essentialkaos/depsy v1.0.0/go.mod h1:XVsB2eVUonEzmLKQP3ig2P6v2+WcHVgJ10zm0JLqFMM= -github.com/essentialkaos/ek/v12 v12.62.0 h1:A+pnMGbSz2apjEjlHU3EQ6Uqam85GTryVPhzcLfY8o4= -github.com/essentialkaos/ek/v12 v12.62.0/go.mod h1:9MlSuHpewu7OZ9tM9dLFHvoA8dflBIUPCA0Ctt97wRs= +github.com/essentialkaos/ek/v12 v12.63.0 h1:9yaEu5W3bx//9y52ShqYCoFDKOcwEdrnvgSkUYyatgI= +github.com/essentialkaos/ek/v12 v12.63.0/go.mod h1:9MlSuHpewu7OZ9tM9dLFHvoA8dflBIUPCA0Ctt97wRs= 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.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= From 655f629058b747c04b2efdfe8ea9271fb68b157f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Mar 2023 05:06:38 +0000 Subject: [PATCH 23/23] Bump actions/setup-go from 3 to 4 Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3 to 4. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5fd255..b92ce12 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: steps: - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: ${{ matrix.go }}