Skip to content

Feat/cli as lib#92

Closed
YOU54F wants to merge 3 commits intomainfrom
feat/cli_as_lib
Closed

Feat/cli as lib#92
YOU54F wants to merge 3 commits intomainfrom
feat/cli_as_lib

Conversation

@YOU54F
Copy link
Copy Markdown
Member

@YOU54F YOU54F commented Oct 8, 2025

📝 Summary of Changes

Changes proposed in this pull request:

  • Modifications to allow pact-plugin-cli to be consumed as a library pact_plugin_cli so it can be composed in other clis

⚠️ Items of Note

Part of a series of pull requests

💁 Example

Composed cli: https://github.com/YOU54F/pact_cli/blob/259a268dd9e7fa48ad03c088f7244af7a4c89493/src/cli.rs#L11-L29

pub fn build_cli() -> Command {
    let app = Command::new("pact_cli")
        .about("A pact cli tool")
        .subcommand(
            pact_broker_cli::cli::pact_broker_client::add_pact_broker_client_command()
                .name("pact-broker")
                .subcommand(add_standalone_broker_subcommand())
                .subcommand(add_docker_broker_subcommand()),
        )
        .args(pact_broker_cli::cli::add_logging_arguments())
        .subcommand(
            pact_broker_cli::cli::pactflow_client::add_pactflow_client_command().name("pactflow"),
        )
        .subcommand(add_completions_subcommand())
        .subcommand(pact_plugin_cli::Cli::command().name("plugin"))
        .subcommand(pact_mock_server_cli::setup_args().name("mock"))
        .subcommand(pact_verifier_cli::args::setup_app().name("verifier"))
        .subcommand(pact_stub_server_cli::build_args().name("stub"));
    app
}

Cargo toml: https://github.com/YOU54F/pact_cli/blob/259a268dd9e7fa48ad03c088f7244af7a4c89493/Cargo.toml#L67-L71

pact-stub-server = { version = "*", git = "https://github.com/YOU54F/pact-stub-server.git", branch = "feat/cli_as_lib"}
pact_mock_server_cli = { version = "2.0.0-beta.1", git = "https://github.com/YOU54F/pact-core-mock-server.git", branch = "feat/cli_as_lib"}
pact-plugin-cli = { version = "*", git = "https://github.com/YOU54F/pact-plugins", branch = "feat/cli_as_lib"}
pact_verifier_cli = { version = "*",  git = "https://github.com/YOU54F/pact-reference", branch = "feat/cli_as_lib"}
pact-broker-cli = { version = "*", git = "https://github.com/YOU54F/pact-broker-cli", branch = "main"}

🔨 How To Test

git clone git@github.com:YOU54F/pact_cli.git
cd pact_cli
git checkout multi-cli
RUSTFLAGS=-Awarnings cargo run -q --

output

A pact cli tool

Usage: pact_cli [OPTIONS] [COMMAND]

Commands:
  pact-broker  
  pactflow     
  completions  Generates completion scripts for your shell
  plugin       CLI utility for Pact plugins
  mock         Standalone Pact mock server
  verifier     Standalone pact verifier for provider pact verification
  stub         Pact Stub Server 0.6.3
  help         Print this message or the help of the given subcommand(s)

Options:
      --log-level <LEVEL>  Set the log level (none, off, error, warn, info, debug, trace) [default: off] [possible values: off, none, error, warn, info, debug, trace]
  -h, --help               Print help

usage

RUSTFLAGS=-Awarnings cargo run -q -- plugin
CLI utility for Pact plugins

Usage: pact_cli plugin [OPTIONS] <COMMAND>

Commands:
  list        List installed or available plugins
  env         Print out the Pact plugin environment config
  install     Install a plugin
  remove      Remove a plugin
  enable      Enable a plugin version
  disable     Disable a plugin version
  repository  Sub-commands for dealing with a plugin repository
  help        Print this message or the help of the given subcommand(s)

Options:
  -y, --yes                Automatically answer Yes for all prompts
  -d, --debug              Enable debug level logs
      --log-level <LEVEL>  Set the log level (none, off, error, warn, info, debug, trace) [default: off] [possible values: off, none, error, warn, info, debug, trace]
  -t, --trace              Enable trace level logs
  -v, --version            Print CLI version
  -h, --help               Print help

@YOU54F
Copy link
Copy Markdown
Member Author

YOU54F commented Oct 22, 2025

todo - rename bin to pact-plugin

@YOU54F
Copy link
Copy Markdown
Member Author

YOU54F commented Oct 31, 2025

merged as part of #93

@YOU54F YOU54F closed this Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant