Skip to content

Commit

Permalink
Fix some potential whitespace bugs and shellcheck with strict rules
Browse files Browse the repository at this point in the history
  • Loading branch information
kernc committed Oct 29, 2023
1 parent 6e800aa commit 8b5553b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: shellcheck diff-logs
- run: shellcheck -o all -e SC2250,SC2292 diff-logs
- run: pip install flake8
- run: flake8 --max-line-length=120 *.py
- run: echo '2000-01-01T00:00:00' > file.log
Expand Down
9 changes: 5 additions & 4 deletions diff-logs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
# See usage instructions below.
#
set -eu
set -o pipefail

lib="$(dirname "$(which "$0")")"
lib="$(command -v "$0" | dirname -)"
pyscript="$lib/diff-logs.py"
difftool="${DIFFTOOL:-diff}"

if [ $# -eq 0 ]; then
$pyscript <&0;
"$pyscript" <&0;
elif [ $# -eq 2 ]; then
case $difftool in diff) args='--color=auto' ;; *) args= ;; esac
# shellcheck disable=SC2086
$difftool $args <($pyscript < "$1") <($pyscript < "$2");
# shellcheck disable=SC2086,SC2248,SC2312
$difftool $args <("$pyscript" < "$1") <("$pyscript" < "$2");
else
echo "Usage: $0 < FILE1.log # Print log file diff-frienly" >&2
echo " $0 FILE1.log FILE2.log # Invoke \$DIFFTOOL (e.g. diff)" >&2
Expand Down

0 comments on commit 8b5553b

Please sign in to comment.