feat: add --format json to git:report and nginx:report
Mirrors the JSON output convention already used by scheduler:report, builder:report, network:report, and traefik:report. Both plugins now accept `--format json` to emit a single-line JSON object whose keys are the property names with the plugin prefix stripped. Combining `--format` with an info flag is rejected with an error message that matches the Go-based report helper. Closes #8499
This commit is contained in:
@@ -731,3 +731,38 @@ teardown() {
|
||||
assert_success
|
||||
assert_output "master"
|
||||
}
|
||||
|
||||
@test "(git:report) --format json" {
|
||||
run /bin/bash -c "dokku git:set $TEST_APP deploy-branch main"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --format json | jq -r '.\"deploy-branch\"'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "main"
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --format json | jq -r '.\"global-deploy-branch\"'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "master"
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --format json | jq -e ."
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:report --format json | jq -e ."
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --format json --git-deploy-branch"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "--format flag cannot be specified when specifying an info flag"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user