From d4ad67f40563f9d124466464a638f7fdc9d78e2f Mon Sep 17 00:00:00 2001 From: danylkaaa Date: Thu, 19 Mar 2020 01:24:58 +0200 Subject: [PATCH 1/7] Add env var LETS_CMD --- commands/run.go | 1 + 1 file changed, 1 insertion(+) diff --git a/commands/run.go b/commands/run.go index 98fe61ec..58554187 100644 --- a/commands/run.go +++ b/commands/run.go @@ -112,6 +112,7 @@ func runCmd(cmdToRun command.Command, cfg *config.Config, out io.Writer, parentN convertEnvMapToList(cmdToRun.CliOptions), convertChecksumToEnvForCmd(cmdToRun.Checksum), convertChecksumMapToEnvForCmd(cmdToRun.ChecksumMap), + makeEnvEntry("LETS_CMD", cmdToRun.name) ) if !isChildCmd { logging.Log.Debugf( From 7a1e515fd56b142ec084090956ffaf5a22d09c58 Mon Sep 17 00:00:00 2001 From: danylkaaa Date: Thu, 19 Mar 2020 01:28:08 +0200 Subject: [PATCH 2/7] add run-if-checksum-changed script --- README.md | 295 ++++++++++++---------- useful-scripts/run-if-checksum-changed.sh | 24 ++ 2 files changed, 183 insertions(+), 136 deletions(-) create mode 100644 useful-scripts/run-if-checksum-changed.sh diff --git a/README.md b/README.md index 975d2172..d42edba8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # lets + Simple CLI task runner Lets takes the best from Makefile and bash and presents you a simple yet powerful tool for defining and running cli tasks and commands. @@ -7,11 +8,12 @@ Just describe your commands in `lets.yaml` and lets will do the rest. > Very alpha software. Things may and will change/break -* [Install](#install) -* [Usage](#usage) -* [Config](#letsyaml) -* [Build](#build) -* [Completion](#completion) +- [Install](#install) +- [Usage](#usage) +- [Config](#letsyaml) +- [Build](#build) +- [Completion](#completion) +- [Useful scrips](#useful-sripts) ## Install @@ -25,7 +27,7 @@ sudo curl -sfL https://raw.githubusercontent.com/lets-cli/lets/master/install.sh **Binary (Cross-platform)**: -Download the version you need for your platform from [Lets Releases](https://github.com/lets-cli/lets/releases). +Download the version you need for your platform from [Lets Releases](https://github.com/lets-cli/lets/releases). Once downloaded, the binary can be run from anywhere. @@ -54,21 +56,21 @@ yay -S lets-git ```yaml commands: - echo: - description: Echo text - cmd: | - echo "Hello" - - run: - description: Run some command - options: | - Usage: lets run [--debug] [--level=] - - Options: - --debug, -d Run with debug - --level= Log level - cmd: | - env + echo: + description: Echo text + cmd: | + echo "Hello" + + run: + description: Run some command + options: | + Usage: lets run [--debug] [--level=] + + Options: + --debug, -d Run with debug + --level= Log level + cmd: | + env ``` 3. Run commands @@ -89,23 +91,23 @@ lets run --debug --level=info Config schema -* [shell](#shell) -* [mixins](#mixins) -* [env](#global-env) -* [eval_env](#global-eval_env) -* [commands](#commands) - * [description](#description) - * [cmd](#cmd) - * [depends](#depends) - * [options](#options) - * [env](#env) - * [eval_env](#eval_env) - * [checksum](#checksum) - +- [shell](#shell) +- [mixins](#mixins) +- [env](#global-env) +- [eval_env](#global-eval_env) +- [commands](#commands) + - [description](#description) + - [cmd](#cmd) + - [depends](#depends) + - [options](#options) + - [env](#env) + - [eval_env](#eval_env) + - [checksum](#checksum) ### Top-level directives: -#### `shell` +#### `shell` + `key: shell` `type: string` @@ -118,7 +120,8 @@ Example: shell: bash ``` -#### `global env` +#### `global env` + `key: env` `type: string` @@ -130,10 +133,11 @@ Example: ```yaml shell: bash env: - MY_GLOBAL_ENV: "123" + MY_GLOBAL_ENV: '123' ``` -#### `global eval_env` +#### `global eval_env` + `key: env` `type: string` @@ -145,10 +149,11 @@ Example: ```yaml shell: bash eval_env: - CURRENT_UID: echo "`id -u`:`id -g`" + CURRENT_UID: echo "`id -u`:`id -g`" ``` -#### `mixins` +#### `mixins` + `key: mixins` `type: list of string` @@ -161,25 +166,26 @@ Example: ```yaml # in lets.yaml -... +--- shell: bash mixins: - - test.yaml + - test.yaml commands: - echo: - cmd: echo Hi - + echo: + cmd: echo Hi + # in test.yaml -... +--- commands: - test: - cmd: echo Testing... + test: + cmd: echo Testing... ``` And `lets test` works fine. #### `commands` + `key: commands` `type: mapping` @@ -190,13 +196,14 @@ Example: ```yaml commands: - test: - description: Test something + test: + description: Test something ``` ### Command directives: ##### `description` + `key: description` `type: string` @@ -207,57 +214,56 @@ Example: ```yaml commands: - test: - description: Test something + test: + description: Test something ``` ##### `cmd` + `key: cmd` `type: string or array of strings` Actual command to run in shell. +You can access command name in your script, it stored in env var `LETS_CMD` + Can be either a string (also a multiline string) or an array of strings. -The main difference is that when specifying an array, all args, specified in terminal will be appended to cmd array +The main difference is that when specifying an array, all args, specified in terminal will be appended to cmd array Example single string: ```yaml commands: - test: - description: Test something - cmd: go test ./... -v - + test: + description: Test something + cmd: go test ./... -v ``` - Example multiline string: ```yaml commands: - test: - description: Test something - cmd: | - echo "Running go tests..." - go test ./... -v - + test: + description: Test something + cmd: | + echo "Running go tests..." + go test ./... -v ``` Example array of strings: ```yaml commands: - test: - description: Test something - cmd: - - go - - test - - ./... + test: + description: Test something + cmd: + - go + - test + - ./... ``` - When run with cmd as array of strings: ```bash @@ -267,6 +273,7 @@ lets test -v the `-v` will be appended, so the resulting command to run will be `go test ./... -v` ##### `depends` + `key: depends` `type: array of string` @@ -278,25 +285,25 @@ Example: ```yaml commands: - build: - description: Build docker image - cmd: docker build -t myimg . -f Dockerfile - - test: - description: Test something - depends: [build] - cmd: go test ./... -v - - fmt: - description: Format the code - depends: [build] - cmd: go fmt + build: + description: Build docker image + cmd: docker build -t myimg . -f Dockerfile + + test: + description: Test something + depends: [build] + cmd: go test ./... -v + + fmt: + description: Format the code + depends: [build] + cmd: go fmt ``` `build` command will be executed each time you run `lets test` or `lets fmt` - ##### `options` + `key: options` `type: string (multiline string)` @@ -317,19 +324,17 @@ Lets see an example: ```yaml commands: - echo-env: - description: Echo env vars - options: - Usage: lets [--log-level=] [--debug] ... - - Options: - ... List of required positional args - --log-level,-l Log level - --debug,-d Run with debug - cmd: | - echo ${LETSOPT_ARGS} - app ${LETSCLI_DEBUG} - + echo-env: + description: Echo env vars + options: + Usage: lets [--log-level=] [--debug] ... + + Options: ... List of required positional args + --log-level,-l Log level + --debug,-d Run with debug + cmd: | + echo ${LETSOPT_ARGS} + app ${LETSCLI_DEBUG} ``` So here we have: @@ -360,28 +365,28 @@ echo LETSCLI_LOG_LEVEL=${LETSCLI_LOG_LEVEL} # LETSCLI_LOG_LEVEL=--log-level info echo LETSCLI_DEBUG=${LETSCLI_DEBUG} # LETSCLI_DEBUG=--debug ``` - ##### `env` + `key: env` `type: mapping string => string` -Env is as simple as it sounds. Define additional env for a commmand: +Env is as simple as it sounds. Define additional env for a commmand: Example: ```yaml commands: - test: - description: Test something - env: - GO111MODULE: "on" - GOPROXY: https://goproxy.io - cmd: go build -o lets *.go + test: + description: Test something + env: + GO111MODULE: 'on' + GOPROXY: https://goproxy.io + cmd: go build -o lets *.go ``` - ##### `eval_env` + `key: eval_env` `type: mapping string => string` @@ -392,18 +397,18 @@ Example: ```yaml commands: - test: - description: Test something - eval_env: - CURRENT_UID: echo "`id -u`:`id -g`" - CURRENT_USER_NAME: echo "`id -un`" - cmd: go build -o lets *.go + test: + description: Test something + eval_env: + CURRENT_UID: echo "`id -u`:`id -g`" + CURRENT_USER_NAME: echo "`id -un`" + cmd: go build -o lets *.go ``` Value will be executed in shell and result will be saved in env. - ##### `checksum` + `key: checksum` `type: array of string | mapping string => array of string` @@ -412,14 +417,14 @@ Checksum used for computing file hashed. It is useful when you depend on some fi In `checksum` you can specify: -- a list of file names +- a list of file names - a list of file regext patterns (parsed via go `path/filepath.Glob`) or - a mapping where key is name of env variable and value is: - - a list of file names - - a list of file regext patterns (parsed via go `path/filepath.Glob`) + - a list of file names + - a list of file regext patterns (parsed via go `path/filepath.Glob`) Each time a command runs, `lets` will calculate the checksum of all files specified in `checksum`. @@ -429,19 +434,19 @@ If checksum is a mapping, e.g: ```yaml commands: - build: - checksum: - deps: - - package.json - doc: - - Readme.md + build: + checksum: + deps: + - package.json + doc: + - Readme.md ``` Resulting env will be: -* `LETS_CHECKSUM_DEPS` - checksum of deps files -* `LETS_CHECKSUM_DOC` - checksum of doc files -* `LETS_CHECKSUM` - checksum of all checksums (deps and doc) +- `LETS_CHECKSUM_DEPS` - checksum of deps files +- `LETS_CHECKSUM_DOC` - checksum of doc files +- `LETS_CHECKSUM` - checksum of all checksums (deps and doc) Checksum is calculated with `sha1`. @@ -452,12 +457,12 @@ Example: ```yaml shell: bash commands: - app-build: - checksum: - - requirements-*.txt - cmd: | - docker pull myrepo/app:${LETS_CHECKSUM} - docker run --rm myrepo/app${LETS_CHECKSUM} python -m app + app-build: + checksum: + - requirements-*.txt + cmd: | + docker pull myrepo/app:${LETS_CHECKSUM} + docker run --rm myrepo/app${LETS_CHECKSUM} python -m app ``` ## Build @@ -478,10 +483,28 @@ go build -o lets *.go && sudo mv ./lets /usr/local/bin/lets You can use Bash/Zsh/Oh-My-Zsh completion in you terminal -* **Bash** +- **Bash** + + Add `source <(lets completion -s bash)` to your `~/.bashrc` or `~/.bash_profile` + +- **Zsh/Oh-My-Zsh** - Add `source <(lets completion -s bash)` to your `~/.bashrc` or `~/.bash_profile` + There is a [repo](https://github.com/lets-cli/lets-zsh-plugin) with zsh plugin with instructions -* **Zsh/Oh-My-Zsh** +### Useful scrips - There is a [repo](https://github.com/lets-cli/lets-zsh-plugin) with zsh plugin with instructions +You can use this bash scripts in your own `lets.yaml` in case, if you wish to implement some functionality, that does not implemented yet in Lets + +- run cmd only if checksum was changed: + +```yaml +# lets.yaml +cmd: + build: + cmd: scripts/run-if-checksum-changed.sh "docker build ." + # |-------path to bash script------|---cmd to run---| + run: + depends: + - build + cmd: docker-compose up +``` diff --git a/useful-scripts/run-if-checksum-changed.sh b/useful-scripts/run-if-checksum-changed.sh new file mode 100644 index 00000000..82243686 --- /dev/null +++ b/useful-scripts/run-if-checksum-changed.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +CMD=$1 +NEW_CHECKSUM=$LETS_CHECKSUM +LABEL=$LETS_CMD +LETS_DIR=.lets + +# ensure lets dir exists +if [[ ! -d "$LETS_DIR" ]]; then + mkdir $LETS_DIR +fi; +# ensure checksum file exists +if [[ ! -f "$LETS_DIR/$LABEL" ]]; then + touch $LETS_DIR/$LABEL +fi; + +# read +PREV_CHECKSUM=$(head -n 1 $LETS_DIR/$LABEL) + +if [[ "$NEW_CHECKSUM" != "$PREV_CHECKSUM" ]]; then + # update checksum + echo $NEW_CHECKSUM > $LETS_DIR/$LABEL + eval $CMD +fi; From 0524429e6f020f080d7aeac8191c3c4dd54b0fa6 Mon Sep 17 00:00:00 2001 From: danylkaaa Date: Thu, 19 Mar 2020 01:35:45 +0200 Subject: [PATCH 3/7] revert format changes in Readme --- README.md | 274 +++++++++++++++++++++++++++--------------------------- 1 file changed, 136 insertions(+), 138 deletions(-) diff --git a/README.md b/README.md index d42edba8..7f5177f0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ # lets - Simple CLI task runner Lets takes the best from Makefile and bash and presents you a simple yet powerful tool for defining and running cli tasks and commands. @@ -8,12 +7,11 @@ Just describe your commands in `lets.yaml` and lets will do the rest. > Very alpha software. Things may and will change/break -- [Install](#install) -- [Usage](#usage) -- [Config](#letsyaml) -- [Build](#build) -- [Completion](#completion) -- [Useful scrips](#useful-sripts) +* [Install](#install) +* [Usage](#usage) +* [Config](#letsyaml) +* [Build](#build) +* [Completion](#completion) ## Install @@ -27,7 +25,7 @@ sudo curl -sfL https://raw.githubusercontent.com/lets-cli/lets/master/install.sh **Binary (Cross-platform)**: -Download the version you need for your platform from [Lets Releases](https://github.com/lets-cli/lets/releases). +Download the version you need for your platform from [Lets Releases](https://github.com/lets-cli/lets/releases). Once downloaded, the binary can be run from anywhere. @@ -56,21 +54,21 @@ yay -S lets-git ```yaml commands: - echo: - description: Echo text - cmd: | - echo "Hello" - - run: - description: Run some command - options: | - Usage: lets run [--debug] [--level=] - - Options: - --debug, -d Run with debug - --level= Log level - cmd: | - env + echo: + description: Echo text + cmd: | + echo "Hello" + + run: + description: Run some command + options: | + Usage: lets run [--debug] [--level=] + + Options: + --debug, -d Run with debug + --level= Log level + cmd: | + env ``` 3. Run commands @@ -91,23 +89,23 @@ lets run --debug --level=info Config schema -- [shell](#shell) -- [mixins](#mixins) -- [env](#global-env) -- [eval_env](#global-eval_env) -- [commands](#commands) - - [description](#description) - - [cmd](#cmd) - - [depends](#depends) - - [options](#options) - - [env](#env) - - [eval_env](#eval_env) - - [checksum](#checksum) +* [shell](#shell) +* [mixins](#mixins) +* [env](#global-env) +* [eval_env](#global-eval_env) +* [commands](#commands) + * [description](#description) + * [cmd](#cmd) + * [depends](#depends) + * [options](#options) + * [env](#env) + * [eval_env](#eval_env) + * [checksum](#checksum) -### Top-level directives: -#### `shell` +### Top-level directives: +#### `shell` `key: shell` `type: string` @@ -120,8 +118,7 @@ Example: shell: bash ``` -#### `global env` - +#### `global env` `key: env` `type: string` @@ -133,11 +130,10 @@ Example: ```yaml shell: bash env: - MY_GLOBAL_ENV: '123' + MY_GLOBAL_ENV: "123" ``` -#### `global eval_env` - +#### `global eval_env` `key: env` `type: string` @@ -149,11 +145,10 @@ Example: ```yaml shell: bash eval_env: - CURRENT_UID: echo "`id -u`:`id -g`" + CURRENT_UID: echo "`id -u`:`id -g`" ``` -#### `mixins` - +#### `mixins` `key: mixins` `type: list of string` @@ -166,26 +161,25 @@ Example: ```yaml # in lets.yaml ---- +... shell: bash mixins: - - test.yaml + - test.yaml commands: - echo: - cmd: echo Hi - + echo: + cmd: echo Hi + # in test.yaml ---- +... commands: - test: - cmd: echo Testing... + test: + cmd: echo Testing... ``` And `lets test` works fine. #### `commands` - `key: commands` `type: mapping` @@ -196,14 +190,13 @@ Example: ```yaml commands: - test: - description: Test something + test: + description: Test something ``` ### Command directives: ##### `description` - `key: description` `type: string` @@ -214,8 +207,8 @@ Example: ```yaml commands: - test: - description: Test something + test: + description: Test something ``` ##### `cmd` @@ -230,40 +223,44 @@ You can access command name in your script, it stored in env var `LETS_CMD` Can be either a string (also a multiline string) or an array of strings. -The main difference is that when specifying an array, all args, specified in terminal will be appended to cmd array +The main difference is that when specifying an array, all args, specified in terminal will be appended to cmd array Example single string: ```yaml commands: - test: - description: Test something - cmd: go test ./... -v + test: + description: Test something + cmd: go test ./... -v + ``` + Example multiline string: ```yaml commands: - test: - description: Test something - cmd: | - echo "Running go tests..." - go test ./... -v + test: + description: Test something + cmd: | + echo "Running go tests..." + go test ./... -v + ``` Example array of strings: ```yaml commands: - test: - description: Test something - cmd: - - go - - test - - ./... + test: + description: Test something + cmd: + - go + - test + - ./... ``` + When run with cmd as array of strings: ```bash @@ -273,7 +270,6 @@ lets test -v the `-v` will be appended, so the resulting command to run will be `go test ./... -v` ##### `depends` - `key: depends` `type: array of string` @@ -285,25 +281,25 @@ Example: ```yaml commands: - build: - description: Build docker image - cmd: docker build -t myimg . -f Dockerfile - - test: - description: Test something - depends: [build] - cmd: go test ./... -v - - fmt: - description: Format the code - depends: [build] - cmd: go fmt + build: + description: Build docker image + cmd: docker build -t myimg . -f Dockerfile + + test: + description: Test something + depends: [build] + cmd: go test ./... -v + + fmt: + description: Format the code + depends: [build] + cmd: go fmt ``` `build` command will be executed each time you run `lets test` or `lets fmt` -##### `options` +##### `options` `key: options` `type: string (multiline string)` @@ -324,17 +320,19 @@ Lets see an example: ```yaml commands: - echo-env: - description: Echo env vars - options: - Usage: lets [--log-level=] [--debug] ... - - Options: ... List of required positional args - --log-level,-l Log level - --debug,-d Run with debug - cmd: | - echo ${LETSOPT_ARGS} - app ${LETSCLI_DEBUG} + echo-env: + description: Echo env vars + options: + Usage: lets [--log-level=] [--debug] ... + + Options: + ... List of required positional args + --log-level,-l Log level + --debug,-d Run with debug + cmd: | + echo ${LETSOPT_ARGS} + app ${LETSCLI_DEBUG} + ``` So here we have: @@ -365,28 +363,28 @@ echo LETSCLI_LOG_LEVEL=${LETSCLI_LOG_LEVEL} # LETSCLI_LOG_LEVEL=--log-level info echo LETSCLI_DEBUG=${LETSCLI_DEBUG} # LETSCLI_DEBUG=--debug ``` -##### `env` +##### `env` `key: env` `type: mapping string => string` -Env is as simple as it sounds. Define additional env for a commmand: +Env is as simple as it sounds. Define additional env for a commmand: Example: ```yaml commands: - test: - description: Test something - env: - GO111MODULE: 'on' - GOPROXY: https://goproxy.io - cmd: go build -o lets *.go + test: + description: Test something + env: + GO111MODULE: "on" + GOPROXY: https://goproxy.io + cmd: go build -o lets *.go ``` -##### `eval_env` +##### `eval_env` `key: eval_env` `type: mapping string => string` @@ -397,18 +395,18 @@ Example: ```yaml commands: - test: - description: Test something - eval_env: - CURRENT_UID: echo "`id -u`:`id -g`" - CURRENT_USER_NAME: echo "`id -un`" - cmd: go build -o lets *.go + test: + description: Test something + eval_env: + CURRENT_UID: echo "`id -u`:`id -g`" + CURRENT_USER_NAME: echo "`id -un`" + cmd: go build -o lets *.go ``` Value will be executed in shell and result will be saved in env. -##### `checksum` +##### `checksum` `key: checksum` `type: array of string | mapping string => array of string` @@ -417,14 +415,14 @@ Checksum used for computing file hashed. It is useful when you depend on some fi In `checksum` you can specify: -- a list of file names +- a list of file names - a list of file regext patterns (parsed via go `path/filepath.Glob`) or - a mapping where key is name of env variable and value is: - - a list of file names - - a list of file regext patterns (parsed via go `path/filepath.Glob`) + - a list of file names + - a list of file regext patterns (parsed via go `path/filepath.Glob`) Each time a command runs, `lets` will calculate the checksum of all files specified in `checksum`. @@ -434,19 +432,19 @@ If checksum is a mapping, e.g: ```yaml commands: - build: - checksum: - deps: - - package.json - doc: - - Readme.md + build: + checksum: + deps: + - package.json + doc: + - Readme.md ``` Resulting env will be: -- `LETS_CHECKSUM_DEPS` - checksum of deps files -- `LETS_CHECKSUM_DOC` - checksum of doc files -- `LETS_CHECKSUM` - checksum of all checksums (deps and doc) +* `LETS_CHECKSUM_DEPS` - checksum of deps files +* `LETS_CHECKSUM_DOC` - checksum of doc files +* `LETS_CHECKSUM` - checksum of all checksums (deps and doc) Checksum is calculated with `sha1`. @@ -457,12 +455,12 @@ Example: ```yaml shell: bash commands: - app-build: - checksum: - - requirements-*.txt - cmd: | - docker pull myrepo/app:${LETS_CHECKSUM} - docker run --rm myrepo/app${LETS_CHECKSUM} python -m app + app-build: + checksum: + - requirements-*.txt + cmd: | + docker pull myrepo/app:${LETS_CHECKSUM} + docker run --rm myrepo/app${LETS_CHECKSUM} python -m app ``` ## Build @@ -483,13 +481,13 @@ go build -o lets *.go && sudo mv ./lets /usr/local/bin/lets You can use Bash/Zsh/Oh-My-Zsh completion in you terminal -- **Bash** +* **Bash** - Add `source <(lets completion -s bash)` to your `~/.bashrc` or `~/.bash_profile` + Add `source <(lets completion -s bash)` to your `~/.bashrc` or `~/.bash_profile` -- **Zsh/Oh-My-Zsh** +* **Zsh/Oh-My-Zsh** - There is a [repo](https://github.com/lets-cli/lets-zsh-plugin) with zsh plugin with instructions + There is a [repo](https://github.com/lets-cli/lets-zsh-plugin) with zsh plugin with instructions ### Useful scrips From d0011b8a13f067ca23824cecb97c84482d5d01ca Mon Sep 17 00:00:00 2001 From: danylkaaa Date: Thu, 19 Mar 2020 01:37:16 +0200 Subject: [PATCH 4/7] add notes about gitignore --- README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 7f5177f0..e8854a71 100644 --- a/README.md +++ b/README.md @@ -493,16 +493,16 @@ You can use Bash/Zsh/Oh-My-Zsh completion in you terminal You can use this bash scripts in your own `lets.yaml` in case, if you wish to implement some functionality, that does not implemented yet in Lets -- run cmd only if checksum was changed: - -```yaml -# lets.yaml -cmd: - build: - cmd: scripts/run-if-checksum-changed.sh "docker build ." - # |-------path to bash script------|---cmd to run---| - run: - depends: - - build - cmd: docker-compose up -``` +- run cmd only if checksum was changed + > Do't forget to add `.lets/` into your `.gitignore ` + ```yaml + # lets.yaml + commands: + build: + cmd: scripts/run-if-checksum-changed.sh "docker build ." + # |-------path to bash script------|---cmd to run---| + run: + depends: + - build + cmd: docker-compose up + ``` From 60af2b5d77c42820d89801ded016622c17473a9c Mon Sep 17 00:00:00 2001 From: danylkaaa Date: Thu, 19 Mar 2020 10:35:17 +0200 Subject: [PATCH 5/7] fix linting --- commands/run.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/run.go b/commands/run.go index 58554187..1a573ad0 100644 --- a/commands/run.go +++ b/commands/run.go @@ -112,7 +112,7 @@ func runCmd(cmdToRun command.Command, cfg *config.Config, out io.Writer, parentN convertEnvMapToList(cmdToRun.CliOptions), convertChecksumToEnvForCmd(cmdToRun.Checksum), convertChecksumMapToEnvForCmd(cmdToRun.ChecksumMap), - makeEnvEntry("LETS_CMD", cmdToRun.name) + makeEnvEntry("LETS_CMD", cmdToRun.name), ) if !isChildCmd { logging.Log.Debugf( From e822f57b33d0846a78532adc510ec3c94da88a33 Mon Sep 17 00:00:00 2001 From: danylkaaa Date: Thu, 19 Mar 2020 13:49:11 +0200 Subject: [PATCH 6/7] fix property accessing --- commands/run.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/run.go b/commands/run.go index 1a573ad0..7fdf8c10 100644 --- a/commands/run.go +++ b/commands/run.go @@ -112,7 +112,7 @@ func runCmd(cmdToRun command.Command, cfg *config.Config, out io.Writer, parentN convertEnvMapToList(cmdToRun.CliOptions), convertChecksumToEnvForCmd(cmdToRun.Checksum), convertChecksumMapToEnvForCmd(cmdToRun.ChecksumMap), - makeEnvEntry("LETS_CMD", cmdToRun.name), + makeEnvEntry("LETS_CMD", cmdToRun.Name), ) if !isChildCmd { logging.Log.Debugf( From eb59456583c0e2d6565659d0843bf8aede9e07f4 Mon Sep 17 00:00:00 2001 From: danylkaaa Date: Thu, 19 Mar 2020 13:56:35 +0200 Subject: [PATCH 7/7] fix tests --- commands/run.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/commands/run.go b/commands/run.go index 7fdf8c10..cf0b5777 100644 --- a/commands/run.go +++ b/commands/run.go @@ -2,14 +2,15 @@ package commands import ( "fmt" - "github.com/docopt/docopt-go" - "github.com/lets-cli/lets/commands/command" - "github.com/lets-cli/lets/config" - "github.com/lets-cli/lets/logging" "io" "os" "os/exec" "strings" + + "github.com/docopt/docopt-go" + "github.com/lets-cli/lets/commands/command" + "github.com/lets-cli/lets/config" + "github.com/lets-cli/lets/logging" ) const ( @@ -112,7 +113,7 @@ func runCmd(cmdToRun command.Command, cfg *config.Config, out io.Writer, parentN convertEnvMapToList(cmdToRun.CliOptions), convertChecksumToEnvForCmd(cmdToRun.Checksum), convertChecksumMapToEnvForCmd(cmdToRun.ChecksumMap), - makeEnvEntry("LETS_CMD", cmdToRun.Name), + []string{makeEnvEntry("LETS_CMD", cmdToRun.Name)}, ) if !isChildCmd { logging.Log.Debugf(