Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No color output #341

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func TestV3HTTPProvider(t *testing.T) {
return models.ProviderStateResponse{"uuid": "1234"}, nil
},
},
DisableColoredOutput: true,
})

assert.NoError(t, err)
Expand Down
5 changes: 5 additions & 0 deletions internal/native/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ void pactffi_verifier_broker_source_with_selectors(VerifierHandle *handle, const
int pactffi_verifier_execute(VerifierHandle *handle);
void pactffi_verifier_add_provider_transport(VerifierHandle *handle, const char *protocol, uint32_t port, const char *path, const char *scheme);
void pactffi_verifier_set_no_pacts_is_error(VerifierHandle *handle, bool is_error);
int pactffi_verifier_set_coloured_output(struct VerifierHandle *handle, bool coloured_output);
*/
import "C"

Expand Down Expand Up @@ -247,6 +248,10 @@ func (v *Verifier) SetNoPactsIsError(isError bool) {
C.pactffi_verifier_set_no_pacts_is_error(v.handle, boolToCInt(isError))
}

func (v *Verifier) SetColoredOutput(isColoredOutput bool) {
C.pactffi_verifier_set_coloured_output(v.handle, boolToCInt(isColoredOutput))
}

func stringArrayToCStringArray(inputs []string) **C.char {
if len(inputs) == 0 {
return nil
Expand Down
4 changes: 4 additions & 0 deletions provider/verify_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ type VerifyRequest struct {

// Disable SSL verification for HTTP requests
DisableSSLVerification bool

// If true, will disable colored output in console.
DisableColoredOutput bool
}

// Validate checks that the minimum fields are provided.
Expand Down Expand Up @@ -261,6 +264,7 @@ func (v *VerifyRequest) validate(handle *native.Verifier) error {
}

handle.SetNoPactsIsError(v.FailIfNoPactsFound)
handle.SetColoredOutput(!v.DisableColoredOutput)

return nil
}
Expand Down
Loading