Exit Codes
sql-splitter uses standard Unix exit codes.
Exit Codes
Section titled “Exit Codes”| Code | Meaning | When |
|---|---|---|
0 |
Success | Command completed without errors |
1 |
Error | Runtime error (I/O, syntax, validation) |
2 |
Invalid arguments | Bad CLI arguments |
Usage in Scripts
Section titled “Usage in Scripts”#!/bin/bashset -e # Exit on error
sql-splitter validate dump.sql --strictecho "Validation passed"Or with explicit handling:
if sql-splitter validate dump.sql --strict; then echo "Valid"else echo "Invalid" exit 1fi# GitHub Actions- name: Validate run: sql-splitter validate dump.sql --strict # Fails step if exit code != 0Validation Exit Codes
Section titled “Validation Exit Codes”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
Checking Exit Codes
Section titled “Checking Exit Codes”sql-splitter validate dump.sql --strictEXIT_CODE=$?
case $EXIT_CODE in 0) echo "Success" ;; 1) echo "Validation failed" ;; 2) echo "Invalid arguments" ;; *) echo "Unknown error: $EXIT_CODE" ;;esacJSON Output with Exit Codes
Section titled “JSON Output with Exit Codes”Single-file JSON output includes an error count in summary:
result=$(sql-splitter validate dump.sql --json)errors=$(echo "$result" | jq -r '.summary.errors')
if [ "$errors" = "0" ]; then echo "Valid"else echo "Invalid"fiIn multi-file mode (glob input), each entry in results has a boolean passed field:
sql-splitter validate "backups/*.sql" --json | jq '.results[] | select(.passed | not) | .file'