-
-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Labels
enhancementImprovement or suggestionImprovement or suggestion
Description
Now that __print_Help is coming into fruition, we could do something like this:
$(__print_example --stdout='https' --status=0 -- get-url-protocol -- 'htstps://bevry.me' || exit $?)
function __print_example {
local item eval=() command expected_stdout expected_status
while [[ $# -ne 0 ]]; do
item="$1"
shift
case "$item" in
'--eval='*) eval_command="${item#*=}" ;;
'--stdout='*) expected_stdout="${item#*=}" ;;
'--status='*) expected_status="${item#*=}" ;;
'--')
eval+=("$@")
shift $#
;;
'--'*) __unrecognised_flag "$item" || return $? ;;
*) __unrecognised_argument "$item" || return $? ;;
esac
done
# @todo cache the result, or figure out error, and perhaps don't test but just output what the results are
eval-tester --stdout="$expected_stdout" --status="$expected_status" -- "${eval[@]}" || return $?
command="$(echo-escape-command -- "${eval[@]}")" || return $?
cat <<-EOF || return $?
\`\`\`
$command
\`\`\`
Outputs: \`$expected_stdout\`
Returns: [$expected_status]
EOF
return 0
}
Metadata
Metadata
Assignees
Labels
enhancementImprovement or suggestionImprovement or suggestion