Skip to content

Commit

Permalink
clean up shellcheck warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
evnp committed Sep 2, 2024
1 parent 14887c1 commit 04bb294
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ e end: # stop app

.PHONY: t test
t test: # run all tests or specific test [vars: name]
@[[ -n "$(1)" ]] && echo "run test $(1)" || echo "run test all"
@[[ -n $(1) ]] && echo "run test $(1)" || echo "run test all"

.PHONY: tests
tests: # run multiple tests [vars: names]
tests: # run multiple tests [vars: name1, name2, etc.]
@echo "run tests $(@)"

.PHONY: r repl
Expand Down
4 changes: 2 additions & 2 deletions Runfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ e end: # stop app
echo "stop app"

t test: # run all tests or specific test [vars: name]
[[ -n "$(1)" ]] && echo "run test $(1)" || echo "run test all"
[[ -n $(1) ]] && echo "run test $(1)" || echo "run test all"

tests: # run multiple tests [vars: names]
tests: # run multiple tests [vars: name1, name2, etc.]
echo "run tests $(@)"

r repl: # start shell in project environment [vars: env='']
Expand Down
13 changes: 6 additions & 7 deletions runfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ e end: # stop app
echo "stop app"
t test: # run all tests or specific test [vars: name]
[[ -n \$(1) ]] && echo "run test \$(1)" || echo "run test all"
tests: # run multiple tests [vars: names]
tests: # run multiple tests [vars: name1, name2, etc.]
echo "run tests \$(@)"
r repl: # start shell in project environment [vars: env='']
echo "start shell in project environment: \$(env)"
Expand All @@ -37,7 +37,7 @@ e end: # stop app
t test: # run all tests or specific test [vars: name]
[[ -n \$(1) ]] && echo "run test \$(1)" || echo "run test all"
tests: # run multiple tests [vars: names]
tests: # run multiple tests [vars: name1, name2, etc.]
echo "run tests \$(@)"
r repl: # start shell in project environment [vars: env='']
Expand Down Expand Up @@ -105,7 +105,7 @@ function cd-to-nearest-file() { local lower='' upper='' title=''
}
function main() ( set -euo pipefail
local makefile='' buffer='' at='' ws='' rewrite='' cmd=''
local makefile='' buffer='' at='' rewrite='' cmd=''
local arg='' make_args=() cmd_args=() pos_args=() pos_arg_idx=0
# Handle various optional actions:
Expand All @@ -124,7 +124,6 @@ function main() ( set -euo pipefail
# Local values:
makefile="$( mktemp )" # Temporary makefile which we will pass to make.
at="@" # @-prefix causes make to execute commands silently.
args=() # Arguments that will be passed on to invoked run command.
# Existing Makefile Compatibility:
# If 'run cmd' or 'make cmd' appears within another command in a Runfile,
Expand Down Expand Up @@ -239,10 +238,10 @@ EOF
else
if grep -qE '\$\([@0-9]\)' "${makefile}"
then
echo 'Warning: Your runfile uses positional args $(@) $(1) $(2) etc.'
echo "Warning: Your runfile uses positional args \$(@) \$(1) \$(2) etc."
echo "which aren't compatible with Make. You'll need to update these"
echo 'commands to accept standard Make-style named arguments:'
echo '$(abc) in your Makefile, passed to task as: $ make task abc=xyz'
echo "commands to accept standard Make-style named arguments:"
echo "\$(abc) in your Makefile, passed to task as: $ make task abc=xyz"
echo
fi
print-makefile "${makefile}" > ./Makefile
Expand Down

0 comments on commit 04bb294

Please sign in to comment.