pact-broker-cli 0.7.0

A Rust and CLI client for the Pact Broker. Publish and retrieve pacts and verification results.
Documentation
use crate::cli::add_output_arguments;
use clap::{Arg, Command};

pub fn add_publish_provider_contract_subcommand() -> Command {
    Command::new("publish-provider-contract")
    .about("Publish provider contract to PactFlow")
    .args(crate::cli::pact_broker::main::subcommands::add_broker_auth_arguments())
    .arg(Arg::new("contract-file")
        .num_args(1)
        .value_name("CONTRACT_FILE")
        .required(true)
        .help("The contract file to publish"))
    .arg(Arg::new("provider")
        .long("provider")
        .value_name("PROVIDER")
        .required(true)
        .help("The provider name"))
    .arg(Arg::new("provider-app-version")
        .short('a')
        .long("provider-app-version")
        .value_name("PROVIDER_APP_VERSION")
        .required_unless_present("auto-detect-version-properties")
        .help("The provider application version"))
    .arg(Arg::new("branch")
        .long("branch")
        .value_name("BRANCH")
        .help("Repository branch of the provider version"))
    .arg(Arg::new("tag")
        .short('t')
        .long("tag")
        .value_delimiter(',')
        .num_args(0..)
        .value_parser(clap::builder::NonEmptyStringValueParser::new())
        .help("Tag name for provider version. Can be specified multiple times (delimiter ,)."))
    .arg(Arg::new("specification")
        .long("specification")
        .value_name("SPECIFICATION")
        .default_value("oas")
        .help("The contract specification"))
    .arg(Arg::new("content-type")
        .long("content-type")
        .value_name("CONTENT_TYPE")
        .help("The content type. eg. application/yml"))
    .arg(Arg::new("verification-success")
        .long("verification-success")
        .action(clap::ArgAction::SetTrue)
        .conflicts_with("verification-exit-code")
        .help("Whether or not the self verification passed successfully."))
    .arg(Arg::new("no-verification-success")
        .long("no-verification-success")
        .action(clap::ArgAction::SetTrue)
        .conflicts_with("verification-exit-code")
        .help("Whether or not the self verification failed."))
    .arg(Arg::new("verification-exit-code")
        .long("verification-exit-code")
        .value_name("N")
        .help("The exit code of the verification process. Can be used instead of --verification-success|--no-verification-success for a simpler build script."))
    .arg(Arg::new("verification-results")
        .long("verification-results")
        .value_name("VERIFICATION_RESULTS")
        .help("The path to the file containing the output from the verification process"))
    .arg(Arg::new("verification-results-content-type")
        .long("verification-results-content-type")
        .value_name("VERIFICATION_RESULTS_CONTENT_TYPE")
        .help("The content type of the verification output eg. text/plain, application/yaml"))
    .arg(Arg::new("verification-results-format")
        .long("verification-results-format")
        .value_name("VERIFICATION_RESULTS_FORMAT")
        .help("The format of the verification output eg. junit, text"))
    .arg(Arg::new("verifier")
        .long("verifier")
        .value_name("VERIFIER")
        .help("The tool used to verify the provider contract"))
    .arg(Arg::new("verifier-version")
        .long("verifier-version")
        .value_name("VERIFIER_VERSION")
        .help("The version of the tool used to verify the provider contract"))
    .arg(Arg::new("build-url")
        .long("build-url")
        .value_name("BUILD_URL")
        .help("The build URL that created the provider contract"))
    .arg(Arg::new("auto-detect-version-properties")
        .short('r')
        .long("auto-detect-version-properties")
        .num_args(0)
        .action(clap::ArgAction::SetTrue)
        .help("Automatically detect the repository commit, branch and build URL from known CI environment variables or git CLI. Supports Buildkite, Circle CI, Travis CI, GitHub Actions, Jenkins, Hudson, AppVeyor, GitLab, CodeShip, Bitbucket and Azure DevOps."))
    .arg(Arg::new("tag-with-git-branch")
        // .short('g')
        .long("tag-with-git-branch")
        .num_args(0)
        .action(clap::ArgAction::SetTrue)
        .help("Tag provider version with the name of the current git branch. Supports Buildkite, Circle CI, Travis CI, GitHub Actions, Jenkins, Hudson, AppVeyor, GitLab, CodeShip, Bitbucket and Azure DevOps."))
    .args(add_output_arguments(["json", "text"].to_vec(), "text"))
    .args(crate::cli::add_ssl_arguments())
}