From 7f02ba2afa4f25f4a7d41ca8d130d06c1fd47596 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Apr 2023 03:01:09 +0000 Subject: [PATCH 01/21] Bump github.com/essentialkaos/ek/v12 from 12.63.0 to 12.64.0 Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.63.0 to 12.64.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.63.0...v12.64.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 d3a8ad60..5a5afb65 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/buger/jsonparser v1.1.1 github.com/essentialkaos/check v1.4.0 github.com/essentialkaos/depsy v1.0.0 - github.com/essentialkaos/ek/v12 v12.63.0 + github.com/essentialkaos/ek/v12 v12.64.0 github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 ) diff --git a/go.sum b/go.sum index c76485b3..b88b0e81 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,8 @@ github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1n github.com/essentialkaos/check v1.4.0/go.mod h1:LMKPZ2H+9PXe7Y2gEoKyVAwUqXVgx7KtgibfsHJPus0= 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.63.0 h1:9yaEu5W3bx//9y52ShqYCoFDKOcwEdrnvgSkUYyatgI= -github.com/essentialkaos/ek/v12 v12.63.0/go.mod h1:9MlSuHpewu7OZ9tM9dLFHvoA8dflBIUPCA0Ctt97wRs= +github.com/essentialkaos/ek/v12 v12.64.0 h1:5HgBltCfY4uwsSFSv+yVBns6UIzXbiNEE31kcm/0UyA= +github.com/essentialkaos/ek/v12 v12.64.0/go.mod h1:9MlSuHpewu7OZ9tM9dLFHvoA8dflBIUPCA0Ctt97wRs= github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 h1:CVuJwN34x4xM2aT4sIKhmeib40NeBPhRihNjQmpJsA4= github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2/go.mod h1:nOFQdrUlIlx6M6ODdSpBj1NVA+VgLC6kmw60mkw34H4= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= From 662d1f211bf40d26a8c84aabd01052f1cbf46b0b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Apr 2023 03:59:55 +0000 Subject: [PATCH 02/21] Bump essentialkaos/aligo-action from 1 to 2 Bumps [essentialkaos/aligo-action](https://github.com/essentialkaos/aligo-action) from 1 to 2. - [Release notes](https://github.com/essentialkaos/aligo-action/releases) - [Commits](https://github.com/essentialkaos/aligo-action/compare/v1...v2) --- updated-dependencies: - dependency-name: essentialkaos/aligo-action 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 abb62347..ee94a61a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -98,7 +98,7 @@ jobs: run: make deps - name: Check Golang sources with Aligo - uses: essentialkaos/aligo-action@v1 + uses: essentialkaos/aligo-action@v2 with: path: ${{env.SRC_DIR}} files: ./... From 5f32c04af8c5ef58daf830d30c47fabb667ac7e3 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Tue, 11 Apr 2023 15:16:17 +0300 Subject: [PATCH 03/21] Improve CI workflow --- .github/workflows/ci.yml | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee94a61a..2e512f55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -env: - SRC_DIR: src/github.com/${{ github.repository }} - jobs: Go: name: Go @@ -30,34 +27,28 @@ jobs: go: [ '1.19.x', '1.20.x' ] steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Go uses: actions/setup-go@v4 with: go-version: ${{ matrix.go }} - - name: Checkout - uses: actions/checkout@v3 - with: - path: ${{env.SRC_DIR}} - - name: Download dependencies - working-directory: ${{env.SRC_DIR}} run: make deps - name: Build binary - working-directory: ${{env.SRC_DIR}} run: make all - name: Run tests - working-directory: ${{env.SRC_DIR}} run: go test -covermode=count ./parser ./recipe -coverprofile=cover.out - name: Send coverage data - uses: essentialkaos/goveralls-action@v1 + uses: essentialkaos/goveralls-action@v2 env: COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - path: ${{env.SRC_DIR}} profile: cover.out parallel: true flag-name: linux-${{ matrix.go }} @@ -70,7 +61,7 @@ jobs: steps: - name: Finish parallel tests - uses: essentialkaos/goveralls-action@v1 + uses: essentialkaos/goveralls-action@v2 env: COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -83,24 +74,20 @@ jobs: needs: Go steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Go uses: actions/setup-go@v4 with: go-version: '1.19.x' - - name: Checkout - uses: actions/checkout@v3 - with: - path: ${{env.SRC_DIR}} - - name: Download dependencies - working-directory: ${{env.SRC_DIR}} run: make deps - name: Check Golang sources with Aligo uses: essentialkaos/aligo-action@v2 with: - path: ${{env.SRC_DIR}} files: ./... Shellcheck: From 03e0e3c52c4dd23ae12f7f7582d98fc48b0cfc04 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Tue, 18 Apr 2023 01:40:18 +0300 Subject: [PATCH 04/21] Fix typos --- COOKBOOK.md | 2 +- cli/cli.go | 10 +++++----- cli/executor/executor.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/COOKBOOK.md b/COOKBOOK.md index abb7f4f6..0a65949e 100644 --- a/COOKBOOK.md +++ b/COOKBOOK.md @@ -310,7 +310,7 @@ command "echo 'ABCD'" "Simple echo command" ``` ```yang -command "USER=john ID=123 echo 'ABCD'" "Simple echo command with enviroment variables" +command "USER=john ID=123 echo 'ABCD'" "Simple echo command with environment variables" expect "ABCD" exit 0 ``` diff --git a/cli/cli.go b/cli/cli.go index eb2d349f..c898ef48 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -58,7 +58,7 @@ const ( OPT_ERROR_DIR = "e:error-dir" OPT_TAG = "t:tag" OPT_QUIET = "q:quiet" - OPT_INGORE_PACKAGES = "ip:ignore-packages" + OPT_IGNORE_PACKAGES = "ip:ignore-packages" OPT_NO_CLEANUP = "nl:no-cleanup" OPT_NO_COLOR = "nc:no-color" OPT_HELP = "h:help" @@ -83,7 +83,7 @@ var optMap = options.Map{ OPT_ERROR_DIR: {}, OPT_TAG: {Mergeble: true}, OPT_QUIET: {Type: options.BOOL}, - OPT_INGORE_PACKAGES: {Type: options.BOOL}, + OPT_IGNORE_PACKAGES: {Type: options.BOOL}, OPT_NO_CLEANUP: {Type: options.BOOL}, OPT_NO_COLOR: {Type: options.BOOL}, OPT_HELP: {Type: options.BOOL}, @@ -352,7 +352,7 @@ func getValidationConfig(tags []string) *executor.ValidationConfig { vc.IgnorePrivileges = true } - if options.GetB(OPT_INGORE_PACKAGES) { + if options.GetB(OPT_IGNORE_PACKAGES) { vc.IgnoreDependencies = true } @@ -403,7 +403,7 @@ func printWarn(f string, a ...interface{}) { } } -// printErrorAndExit print error mesage and exit with exit code 1 +// printErrorAndExit print error message and exit with exit code 1 func printErrorAndExit(f string, a ...interface{}) { printError(f, a...) os.Exit(1) @@ -456,7 +456,7 @@ func genUsage() *usage.Info { info.AddOption(OPT_ERROR_DIR, "Path to directory for errors data", "dir") info.AddOption(OPT_TAG, "One or more command tags to run", "tag") info.AddOption(OPT_QUIET, "Quiet mode") - info.AddOption(OPT_INGORE_PACKAGES, "Do not check system for installed packages") + info.AddOption(OPT_IGNORE_PACKAGES, "Do not check system for installed packages") info.AddOption(OPT_NO_CLEANUP, "Disable deleting files created during tests") info.AddOption(OPT_NO_COLOR, "Disable colors in output") info.AddOption(OPT_HELP, "Show this help message") diff --git a/cli/executor/executor.go b/cli/executor/executor.go index ee610259..473a96ae 100644 --- a/cli/executor/executor.go +++ b/cli/executor/executor.go @@ -495,7 +495,7 @@ func logError(e *Executor, c *recipe.Command, a *recipe.Action, ce *CommandEnv, } } -// getErrorOrigin returns info about error orign +// getErrorOrigin returns info about error origin func getErrorOrigin(c *recipe.Command, a *recipe.Action, id string) string { switch a { case nil: From f397c193c3e50c2dd0c5ca648c5a162c6deed917 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Tue, 18 Apr 2023 01:40:47 +0300 Subject: [PATCH 05/21] Improve CI workflow --- .github/workflows/ci.yml | 13 +++++++++++++ .typos.toml | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 .typos.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e512f55..f9e0a8bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,6 +120,19 @@ jobs: with: files: .docker/centos7.docker .docker/ol7.docker .docker/ol8.docker .docker/ol9.docker + Typos: + name: Typos + runs-on: ubuntu-latest + + needs: Go + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Check spelling + uses: crate-ci/typos@master + DockerBuild: name: Docker Build Check runs-on: ubuntu-latest diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 00000000..55aead83 --- /dev/null +++ b/.typos.toml @@ -0,0 +1,2 @@ +[files] +extend-exclude = ["go.sum"] From f349fe28c5a867dfc22a2a8d7ab1cc072a92a7eb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Apr 2023 02:59:54 +0000 Subject: [PATCH 06/21] Bump github.com/essentialkaos/ek/v12 from 12.64.0 to 12.64.1 Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.64.0 to 12.64.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.64.0...v12.64.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 | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 5a5afb65..de2325aa 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/buger/jsonparser v1.1.1 github.com/essentialkaos/check v1.4.0 github.com/essentialkaos/depsy v1.0.0 - github.com/essentialkaos/ek/v12 v12.64.0 + github.com/essentialkaos/ek/v12 v12.64.1 github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 ) @@ -14,6 +14,6 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/rogpeppe/go-internal v1.9.0 // indirect - golang.org/x/crypto v0.7.0 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/crypto v0.8.0 // indirect + golang.org/x/sys v0.7.0 // indirect ) diff --git a/go.sum b/go.sum index b88b0e81..4c1e4e0a 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,8 @@ github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1n github.com/essentialkaos/check v1.4.0/go.mod h1:LMKPZ2H+9PXe7Y2gEoKyVAwUqXVgx7KtgibfsHJPus0= 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.64.0 h1:5HgBltCfY4uwsSFSv+yVBns6UIzXbiNEE31kcm/0UyA= -github.com/essentialkaos/ek/v12 v12.64.0/go.mod h1:9MlSuHpewu7OZ9tM9dLFHvoA8dflBIUPCA0Ctt97wRs= +github.com/essentialkaos/ek/v12 v12.64.1 h1:XjIF4GHCgVIY0S0KEz8g1OrNrRoHGU+vAUXSYIKNIbI= +github.com/essentialkaos/ek/v12 v12.64.1/go.mod h1:PFJckNu+x4mHqsjndUeYRDPgDgvZEgcjpy1RpCYtx4g= github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 h1:CVuJwN34x4xM2aT4sIKhmeib40NeBPhRihNjQmpJsA4= github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2/go.mod h1:nOFQdrUlIlx6M6ODdSpBj1NVA+VgLC6kmw60mkw34H4= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -16,7 +16,7 @@ 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.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= +golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= From 757396d43e56d5810aeaeec2e4be16503395b97b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Apr 2023 02:59:59 +0000 Subject: [PATCH 07/21] Bump github.com/essentialkaos/ek/v12 from 12.64.1 to 12.65.0 Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.64.1 to 12.65.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.64.1...v12.65.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 de2325aa..05dfd0e7 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/buger/jsonparser v1.1.1 github.com/essentialkaos/check v1.4.0 github.com/essentialkaos/depsy v1.0.0 - github.com/essentialkaos/ek/v12 v12.64.1 + github.com/essentialkaos/ek/v12 v12.65.0 github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 ) diff --git a/go.sum b/go.sum index 4c1e4e0a..f182d75b 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,8 @@ github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1n github.com/essentialkaos/check v1.4.0/go.mod h1:LMKPZ2H+9PXe7Y2gEoKyVAwUqXVgx7KtgibfsHJPus0= 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.64.1 h1:XjIF4GHCgVIY0S0KEz8g1OrNrRoHGU+vAUXSYIKNIbI= -github.com/essentialkaos/ek/v12 v12.64.1/go.mod h1:PFJckNu+x4mHqsjndUeYRDPgDgvZEgcjpy1RpCYtx4g= +github.com/essentialkaos/ek/v12 v12.65.0 h1:OYs8HrVxzzG8CYW9s2wc6Ihfg+ZAnMGB94xzVEC+NMU= +github.com/essentialkaos/ek/v12 v12.65.0/go.mod h1:PFJckNu+x4mHqsjndUeYRDPgDgvZEgcjpy1RpCYtx4g= github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 h1:CVuJwN34x4xM2aT4sIKhmeib40NeBPhRihNjQmpJsA4= github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2/go.mod h1:nOFQdrUlIlx6M6ODdSpBj1NVA+VgLC6kmw60mkw34H4= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= From 91b646d3dc00d8556a8e55e18bd1598f4ecd144d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 May 2023 02:59:42 +0000 Subject: [PATCH 08/21] Bump github.com/essentialkaos/ek/v12 from 12.65.0 to 12.66.0 Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.65.0 to 12.66.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.65.0...v12.66.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 05dfd0e7..b7c3f786 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/buger/jsonparser v1.1.1 github.com/essentialkaos/check v1.4.0 github.com/essentialkaos/depsy v1.0.0 - github.com/essentialkaos/ek/v12 v12.65.0 + github.com/essentialkaos/ek/v12 v12.66.0 github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 ) diff --git a/go.sum b/go.sum index f182d75b..c5777e6c 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,8 @@ github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1n github.com/essentialkaos/check v1.4.0/go.mod h1:LMKPZ2H+9PXe7Y2gEoKyVAwUqXVgx7KtgibfsHJPus0= 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.65.0 h1:OYs8HrVxzzG8CYW9s2wc6Ihfg+ZAnMGB94xzVEC+NMU= -github.com/essentialkaos/ek/v12 v12.65.0/go.mod h1:PFJckNu+x4mHqsjndUeYRDPgDgvZEgcjpy1RpCYtx4g= +github.com/essentialkaos/ek/v12 v12.66.0 h1:g/eg9IPKFDYHt0v5qB3b9pBeSSZ+N7gJdxdOLXIPFLA= +github.com/essentialkaos/ek/v12 v12.66.0/go.mod h1:PFJckNu+x4mHqsjndUeYRDPgDgvZEgcjpy1RpCYtx4g= github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 h1:CVuJwN34x4xM2aT4sIKhmeib40NeBPhRihNjQmpJsA4= github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2/go.mod h1:nOFQdrUlIlx6M6ODdSpBj1NVA+VgLC6kmw60mkw34H4= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= From c5bc2f285cbbbbc43f461f48efd09e6826fa6984 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 May 2023 03:02:07 +0000 Subject: [PATCH 09/21] Bump github.com/essentialkaos/ek/v12 from 12.66.0 to 12.67.0 Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.66.0 to 12.67.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.66.0...v12.67.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 | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index b7c3f786..60cdda92 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/buger/jsonparser v1.1.1 github.com/essentialkaos/check v1.4.0 github.com/essentialkaos/depsy v1.0.0 - github.com/essentialkaos/ek/v12 v12.66.0 + github.com/essentialkaos/ek/v12 v12.67.0 github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 ) @@ -15,5 +15,5 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/rogpeppe/go-internal v1.9.0 // indirect golang.org/x/crypto v0.8.0 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect ) diff --git a/go.sum b/go.sum index c5777e6c..422d97ee 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,8 @@ github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1n github.com/essentialkaos/check v1.4.0/go.mod h1:LMKPZ2H+9PXe7Y2gEoKyVAwUqXVgx7KtgibfsHJPus0= 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.66.0 h1:g/eg9IPKFDYHt0v5qB3b9pBeSSZ+N7gJdxdOLXIPFLA= -github.com/essentialkaos/ek/v12 v12.66.0/go.mod h1:PFJckNu+x4mHqsjndUeYRDPgDgvZEgcjpy1RpCYtx4g= +github.com/essentialkaos/ek/v12 v12.67.0 h1:ii15t0O+3Mu7uI3Te5X5BIqYXi1V7ovtSIYi5LyiltU= +github.com/essentialkaos/ek/v12 v12.67.0/go.mod h1:sRgw+F7PeeoNsmLLVMKy5ccugwGSljk8/rTXC9dyT+M= github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 h1:CVuJwN34x4xM2aT4sIKhmeib40NeBPhRihNjQmpJsA4= github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2/go.mod h1:nOFQdrUlIlx6M6ODdSpBj1NVA+VgLC6kmw60mkw34H4= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -18,5 +18,5 @@ github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZV github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= From 2d6dc3df061293dd636379f8f8d8bf583704b791 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 May 2023 02:59:21 +0000 Subject: [PATCH 10/21] Bump github.com/essentialkaos/depsy from 1.0.0 to 1.1.0 Bumps [github.com/essentialkaos/depsy](https://github.com/essentialkaos/depsy) from 1.0.0 to 1.1.0. - [Release notes](https://github.com/essentialkaos/depsy/releases) - [Commits](https://github.com/essentialkaos/depsy/compare/v1.0.0...v1.1.0) --- updated-dependencies: - dependency-name: github.com/essentialkaos/depsy dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 60cdda92..690f77d3 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/buger/jsonparser v1.1.1 github.com/essentialkaos/check v1.4.0 - github.com/essentialkaos/depsy v1.0.0 + github.com/essentialkaos/depsy v1.1.0 github.com/essentialkaos/ek/v12 v12.67.0 github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 ) @@ -13,7 +13,7 @@ require ( require ( github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect - github.com/rogpeppe/go-internal v1.9.0 // indirect + github.com/rogpeppe/go-internal v1.10.0 // indirect golang.org/x/crypto v0.8.0 // indirect golang.org/x/sys v0.8.0 // indirect ) diff --git a/go.sum b/go.sum index 422d97ee..c52f6fb0 100644 --- a/go.sum +++ b/go.sum @@ -3,8 +3,8 @@ github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx2 github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1nkuKk= github.com/essentialkaos/check v1.4.0/go.mod h1:LMKPZ2H+9PXe7Y2gEoKyVAwUqXVgx7KtgibfsHJPus0= -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/depsy v1.1.0 h1:U6dp687UkQwXlZU17Hg2KMxbp3nfZAoZ8duaeUFYvJI= +github.com/essentialkaos/depsy v1.1.0/go.mod h1:kpiTAV17dyByVnrbNaMcZt2jRwvuXClUYOzpyJQwtG8= github.com/essentialkaos/ek/v12 v12.67.0 h1:ii15t0O+3Mu7uI3Te5X5BIqYXi1V7ovtSIYi5LyiltU= github.com/essentialkaos/ek/v12 v12.67.0/go.mod h1:sRgw+F7PeeoNsmLLVMKy5ccugwGSljk8/rTXC9dyT+M= github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 h1:CVuJwN34x4xM2aT4sIKhmeib40NeBPhRihNjQmpJsA4= @@ -14,8 +14,9 @@ github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3x 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.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= From 19e9ab1d2a5bdfcd120f63e7108ed05844af9619 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Sun, 14 May 2023 12:15:50 +0300 Subject: [PATCH 11/21] Add codeclimate badge --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 10a73eab..1fdc10c0 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@

- GitHub Actions CI Status GoReportCard + Code Climate Maintainability codebeat badge +
+ GitHub Actions CI Status GitHub Actions CodeQL Status @@ -25,7 +27,7 @@ Information about bibop recipe syntax you can find in our [cookbook](COOKBOOK.md #### From source -To build the `bibop` from scratch, make sure you have a working Go 1.18+ workspace ([instructions](https://golang.org/doc/install)), then: +To build the `bibop` from scratch, make sure you have a working Go 1.18+ workspace ([instructions](https://go.dev/doc/install)), then: ``` go install github.com/essentialkaos/bibop@latest From db0e8c8181f85bf17c09eed046e9fc5f639872cd Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Sun, 14 May 2023 12:16:05 +0300 Subject: [PATCH 12/21] Add codeclimate badge --- .codeclimate.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .codeclimate.yml diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 00000000..16f43246 --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,39 @@ +version: "2" + +checks: + argument-count: + enabled: true + config: + threshold: 6 + complex-logic: + enabled: true + config: + threshold: 6 + file-lines: + enabled: true + config: + threshold: 1000 + method-complexity: + enabled: true + config: + threshold: 8 + method-count: + enabled: true + config: + threshold: 20 + method-lines: + enabled: true + config: + threshold: 100 + nested-control-flow: + enabled: true + config: + threshold: 6 + return-statements: + enabled: true + config: + threshold: 6 + similar-code: + enabled: false + identical-code: + enabled: false From dac57f75176c10adcba3aae79ee2f69868389051 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Sun, 14 May 2023 12:16:38 +0300 Subject: [PATCH 13/21] Dependencies update --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 690f77d3..0c675ed7 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/buger/jsonparser v1.1.1 github.com/essentialkaos/check v1.4.0 github.com/essentialkaos/depsy v1.1.0 - github.com/essentialkaos/ek/v12 v12.67.0 + github.com/essentialkaos/ek/v12 v12.67.1 github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 ) @@ -14,6 +14,6 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - golang.org/x/crypto v0.8.0 // indirect + golang.org/x/crypto v0.9.0 // indirect golang.org/x/sys v0.8.0 // indirect ) diff --git a/go.sum b/go.sum index c52f6fb0..f09dbee0 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,8 @@ github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1n github.com/essentialkaos/check v1.4.0/go.mod h1:LMKPZ2H+9PXe7Y2gEoKyVAwUqXVgx7KtgibfsHJPus0= github.com/essentialkaos/depsy v1.1.0 h1:U6dp687UkQwXlZU17Hg2KMxbp3nfZAoZ8duaeUFYvJI= github.com/essentialkaos/depsy v1.1.0/go.mod h1:kpiTAV17dyByVnrbNaMcZt2jRwvuXClUYOzpyJQwtG8= -github.com/essentialkaos/ek/v12 v12.67.0 h1:ii15t0O+3Mu7uI3Te5X5BIqYXi1V7ovtSIYi5LyiltU= -github.com/essentialkaos/ek/v12 v12.67.0/go.mod h1:sRgw+F7PeeoNsmLLVMKy5ccugwGSljk8/rTXC9dyT+M= +github.com/essentialkaos/ek/v12 v12.67.1 h1:RSQxq0TaALADLVYhILky5nFQw8G1HeryUy8C6td35PA= +github.com/essentialkaos/ek/v12 v12.67.1/go.mod h1:SDR3JJJa8FySwRusH/h1gg5c6kpdF18aCkeK7eQSlic= github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 h1:CVuJwN34x4xM2aT4sIKhmeib40NeBPhRihNjQmpJsA4= github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2/go.mod h1:nOFQdrUlIlx6M6ODdSpBj1NVA+VgLC6kmw60mkw34H4= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -17,7 +17,7 @@ github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsK github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= -golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= -golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= +golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= From 95db1ca14e70bbab5c69c40c7ff67404f1db48d1 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Sun, 14 May 2023 12:17:21 +0300 Subject: [PATCH 14/21] Improve README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1fdc10c0..de9fe77b 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@

+ GoReportCard Code Climate Maintainability codebeat badge
GitHub Actions CI Status GitHub Actions CodeQL Status -

From b8630e3db78f4feeb5d3adaa2557eeb71f56e7d6 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Sun, 14 May 2023 12:18:29 +0300 Subject: [PATCH 15/21] Custom version info formats support --- cli/cli.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index c898ef48..b119bc38 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -87,7 +87,7 @@ var optMap = options.Map{ OPT_NO_CLEANUP: {Type: options.BOOL}, OPT_NO_COLOR: {Type: options.BOOL}, OPT_HELP: {Type: options.BOOL}, - OPT_VER: {Type: options.BOOL}, + OPT_VER: {Type: options.MIXED}, OPT_VERB_VER: {Type: options.BOOL}, OPT_COMPLETION: {}, @@ -119,7 +119,7 @@ func Run(gitRev string, gomod []byte) { printMan() os.Exit(0) case options.GetB(OPT_VER): - genAbout(gitRev).Print() + genAbout(gitRev).Print(options.GetS(OPT_VER)) os.Exit(0) case options.GetB(OPT_VERB_VER): support.Print(APP, VER, gitRev, gomod) From 0ef6546eb5be99b2867ad0c5e20b44f13aa88a07 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Sun, 14 May 2023 12:20:50 +0300 Subject: [PATCH 16/21] Version bump --- cli/cli.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/cli.go b/cli/cli.go index b119bc38..184537dc 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -39,7 +39,7 @@ import ( // Application info const ( APP = "bibop" - VER = "7.1.0" + VER = "7.1.1" DESC = "Utility for testing command-line tools" ) From 83e670dc2db0373772462ccdbcd871ddefc3c4c5 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Sun, 14 May 2023 12:21:52 +0300 Subject: [PATCH 17/21] Improve README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index de9fe77b..f8b6cfe1 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@

- GoReportCard Code Climate Maintainability codebeat badge
+ GitHub Actions CI Status GitHub Actions CodeQL Status From 8eab7bcf4d556fe8cb093ed8f95084d98c4f2330 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Sun, 14 May 2023 14:41:44 +0300 Subject: [PATCH 18/21] Improve working dir cleanup mechanic --- cli/executor/executor.go | 46 ++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/cli/executor/executor.go b/cli/executor/executor.go index 473a96ae..33a7c22b 100644 --- a/cli/executor/executor.go +++ b/cli/executor/executor.go @@ -43,12 +43,13 @@ const MAX_STORAGE_SIZE = 8 * 1024 * 1024 // 8 MB // Executor is executor struct type Executor struct { - config *Config // Config - start time.Time // Time when recipe execution started - passes int // Number of passed commands - fails int // Number of failed commands - skipped int // Number of skipped commands - logger *log.Logger // Pointer to logger + config *Config // Configuration + start time.Time // Time when recipe execution started + passes int // Number of passed commands + fails int // Number of failed commands + skipped int // Number of skipped commands + logger *log.Logger // Pointer to logger + wrkDirObjs map[string]bool // Map with working dir objects } // ExecutorConfig contains executor configuration @@ -180,6 +181,8 @@ func (e *Executor) Run(rr render.Renderer, r *recipe.Recipe, tags []string) bool os.Chdir(r.Dir) } + e.wrkDirObjs = getWorkingDirObjects(r.Dir) + applyRecipeOptions(e, rr, r) processRecipe(e, rr, r, tags) @@ -552,23 +555,38 @@ func cleanTempData() { temp.Clean() } +// getWorkingDirObjects returns map with all objects in working dir +func getWorkingDirObjects(workingDir string) map[string]bool { + targets := fsutil.ListAll(workingDir, false) + fsutil.ListToAbsolute(workingDir, targets) + + if len(targets) == 0 { + return nil + } + + result := make(map[string]bool) + + for _, target := range targets { + result[target] = true + } + + return result +} + // cleanupWorkingDir cleanup working dir func cleanupWorkingDir(e *Executor, workingDir string) { if e.config.DisableCleanup { return } - targets := fsutil.ListAll(workingDir, false, fsutil.ListingFilter{ - CTimeYounger: e.start.Unix(), - }) - + targets := fsutil.ListAll(workingDir, false) fsutil.ListToAbsolute(workingDir, targets) - if len(targets) == 0 { - return - } - for _, target := range targets { + if e.wrkDirObjs != nil && e.wrkDirObjs[target] { + continue + } + os.RemoveAll(target) } } From eddcd0576f78b9b9296551784259c777249a7760 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Sun, 14 May 2023 15:16:01 +0300 Subject: [PATCH 19/21] Add 'output-empty' command --- COOKBOOK.md | 17 +++++++++++++++++ action/io.go | 12 ++++++++++++ cli/cli.go | 2 +- cli/executor/executor.go | 2 ++ recipe/tokens.go | 2 ++ 5 files changed, 34 insertions(+), 1 deletion(-) diff --git a/COOKBOOK.md b/COOKBOOK.md index 0a65949e..d08525db 100644 --- a/COOKBOOK.md +++ b/COOKBOOK.md @@ -602,6 +602,23 @@ command "echo 'ABCD'" "Simple echo command" +##### `output-empty` + +Checks if the output is empty. + +**Syntax:** `output-empty` + +**Negative form:** Yes + +**Example:** + +```yang +command "echo 'ABCD'" "Simple echo command" + !output-empty +``` + + + ##### `output-trim` Trims output (_remove output data from store_). diff --git a/action/io.go b/action/io.go index 75af8d98..df88a523 100644 --- a/action/io.go +++ b/action/io.go @@ -151,6 +151,18 @@ func OutputContains(action *recipe.Action, output *OutputContainer) error { return nil } +// OutputEmpty is action processor for "output-empty" +func OutputEmpty(action *recipe.Action, output *OutputContainer) error { + switch { + case !action.Negative && !output.IsEmpty(): + return fmt.Errorf("Output contains data") + case action.Negative && output.IsEmpty(): + return fmt.Errorf("Output is empty") + } + + return nil +} + // OutputTrim is action processor for "output-trim" func OutputTrim(action *recipe.Action, output *OutputContainer) error { output.Purge() diff --git a/cli/cli.go b/cli/cli.go index 184537dc..277cbb50 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -39,7 +39,7 @@ import ( // Application info const ( APP = "bibop" - VER = "7.1.1" + VER = "7.2.0" DESC = "Utility for testing command-line tools" ) diff --git a/cli/executor/executor.go b/cli/executor/executor.go index 33a7c22b..988fae16 100644 --- a/cli/executor/executor.go +++ b/cli/executor/executor.go @@ -390,6 +390,8 @@ func runAction(a *recipe.Action, cmdEnv *CommandEnv) error { return action.WaitOutput(a, cmdEnv.output) case recipe.ACTION_OUTPUT_CONTAINS: return action.OutputContains(a, cmdEnv.output) + case recipe.ACTION_OUTPUT_EMPTY: + return action.OutputEmpty(a, cmdEnv.output) case recipe.ACTION_OUTPUT_MATCH: return action.OutputMatch(a, cmdEnv.output) case recipe.ACTION_OUTPUT_TRIM: diff --git a/recipe/tokens.go b/recipe/tokens.go index 4c022563..7faddcc1 100644 --- a/recipe/tokens.go +++ b/recipe/tokens.go @@ -31,6 +31,7 @@ const ( ACTION_WAIT_OUTPUT = "wait-output" ACTION_OUTPUT_MATCH = "output-match" ACTION_OUTPUT_CONTAINS = "output-contains" + ACTION_OUTPUT_EMPTY = "output-empty" ACTION_OUTPUT_TRIM = "output-trim" ACTION_PRINT = "print" @@ -139,6 +140,7 @@ var Tokens = []TokenInfo{ {ACTION_WAIT_OUTPUT, 1, 1, false, false}, {ACTION_OUTPUT_MATCH, 1, 1, false, true}, {ACTION_OUTPUT_CONTAINS, 1, 1, false, true}, + {ACTION_OUTPUT_EMPTY, 0, 0, false, true}, {ACTION_OUTPUT_TRIM, 0, 0, false, false}, {ACTION_PRINT, 1, 1, false, false}, From b722373943f3bbec6c485936959ae0ca1f264c89 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Mon, 15 May 2023 00:19:25 +0300 Subject: [PATCH 20/21] Update cookbook --- COOKBOOK.md | 1 + 1 file changed, 1 insertion(+) diff --git a/COOKBOOK.md b/COOKBOOK.md index d08525db..273b298b 100644 --- a/COOKBOOK.md +++ b/COOKBOOK.md @@ -24,6 +24,7 @@ * [`wait-output`](#wait-output) * [`output-match`](#output-match) * [`output-contains`](#output-contains) + * [`output-empty`](#output-empty) * [`output-trim`](#output-trim) * [Filesystem](#filesystem) * [`chdir`](#chdir) From 4f03f18a07dda638a7e28a3599c3305ce27f1df3 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Mon, 15 May 2023 00:39:35 +0300 Subject: [PATCH 21/21] Regenerate Makefile with the latest version of gomakegen --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index aa94a179..d48c38e8 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 @@ -105,6 +105,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' ################################################################################