#!/usr/bin/env bash # Shared interface for daedalus bash scripts (SPEC.md item 6.10). # # A registered bash script sources this sibling file once and ends with: # daedalus_bash_dispatch "$@" # The script defines help() (its usage text) and main() (its body). # daedalus completes the help words for the script (SPEC item 3.13.5.2); # this helper runs them: help, -h, and --help print help(), everything # else goes to main() with the arguments unchanged. help() { echo "bash script error: help() is not defined (SPEC item 6.10.2)" >&2 return 2 } main() { echo "bash script error: main() is not defined (SPEC item 6.10.3)" >&2 return 2 } daedalus_is_help_request() { case "${1-}" in help|-h|--help) return 0 ;; *) return 1 ;; esac } daedalus_bash_dispatch() { if daedalus_is_help_request "${1:-}"; then help local status=$? exit "$status" fi main "$@" }