Skip to content

Exit Codes

sql-splitter uses standard Unix exit codes.

CodeMeaningWhen
0SuccessCommand completed without errors
1ErrorRuntime error (I/O, syntax, validation)
2Invalid argumentsBad CLI arguments
#!/bin/bash
set -e # Exit on error
sql-splitter validate dump.sql --strict
echo "Validation passed"

Or with explicit handling:

Terminal window
if sql-splitter validate dump.sql --strict; then
echo "Valid"
else
echo "Invalid"
exit 1
fi
# GitHub Actions
- name: Validate
run: sql-splitter validate dump.sql --strict
# Fails step if exit code != 0

With --strict:

  • Exit 0: No errors AND no warnings
  • Exit 1: Errors or warnings present

Without --strict:

  • Exit 0: No errors (warnings are ignored)
  • Exit 1: Errors present
Terminal window
sql-splitter validate dump.sql --strict
EXIT_CODE=$?
case $EXIT_CODE in
0)
echo "Success"
;;
1)
echo "Validation failed"
;;
2)
echo "Invalid arguments"
;;
*)
echo "Unknown error: $EXIT_CODE"
;;
esac

JSON output includes a passed field:

Terminal window
result=$(sql-splitter validate dump.sql --json)
passed=$(echo "$result" | jq -r '.passed')
if [ "$passed" = "true" ]; then
echo "Valid"
else
echo "Invalid"
fi