31 lines
703 B
Bash
31 lines
703 B
Bash
|
|
#!/bin/bash
|
||
|
|
# FormInquire wrapper for shell scripts
|
||
|
|
# Simple wrapper to execute FormInquire forms from bash/sh
|
||
|
|
|
||
|
|
set -e
|
||
|
|
|
||
|
|
FORM_FILE="${1:-}"
|
||
|
|
OUTPUT_FORMAT="${2:-json}"
|
||
|
|
|
||
|
|
# Check if form file provided
|
||
|
|
if [ -z "$FORM_FILE" ]; then
|
||
|
|
echo "Error: Form file required" >&2
|
||
|
|
echo "Usage: form.sh <form_file> [output_format]" >&2
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Check if form file exists
|
||
|
|
if [ ! -f "$FORM_FILE" ]; then
|
||
|
|
echo "Error: Form file not found: $FORM_FILE" >&2
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Check if forminquire is available
|
||
|
|
if ! command -v forminquire &> /dev/null; then
|
||
|
|
echo "Error: forminquire not found in PATH" >&2
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Execute forminquire
|
||
|
|
forminquire --from-file "$FORM_FILE" --output "$OUTPUT_FORMAT"
|