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”JSON output includes a passed field:
result=$(sql-splitter validate dump.sql --json)passed=$(echo "$result" | jq -r '.passed')
if [ "$passed" = "true" ]; then echo "Valid"else echo "Invalid"fi