| Crates.io | help-probe |
| lib.rs | help-probe |
| version | 0.1.0 |
| created_at | 2025-12-22 06:22:34.687145+00 |
| updated_at | 2025-12-22 06:22:34.687145+00 |
| description | CLI tool discovery and automation framework that extracts structured information from command help text |
| homepage | https://github.com/byezy/help-probe |
| repository | https://github.com/byezy/help-probe |
| max_upload_size | |
| id | 1999149 |
| size | 290,771 |
A comprehensive CLI tool discovery and automation framework that extracts structured information from command help text. Transform any CLI tool's help output into machine-readable data for automation, scripting, documentation generation, and IDE integration.
--help, -h, help, etc.) when none are providedgit clone <repository-url>
cd help-probe
cargo build --release
The binary will be available at target/release/help-probe.
cargo install --path .
Probe a command's help text. The program automatically detects and uses appropriate help flags:
help-probe -- ls
help-probe -- docker
help-probe -- git
help-probe -- cargo
You can also explicitly provide help flags:
help-probe -- ls --help
help-probe -- docker -h
Get structured JSON output:
help-probe --json -- ls --help
Generate completion scripts that enable tab completion for commands in your shell. These scripts provide intelligent suggestions when you press Tab, showing available options, subcommands, and arguments.
What are completion scripts?
.sh for bash, .ps1 for PowerShell, .nu for NuShell, etc.) that tell your shell how to complete commandsExample: After loading a completion script for docker, typing docker <TAB> will show all available subcommands (build, run, ps, etc.), and docker run --<TAB> will show all available options.
How to use them:
help-probe --generate-completion <shell> --output <file> -- <command>source <file> (bash/zsh) or . <file> (PowerShell)The --output flag is recommended (works in all shells, prompts if file exists):
# Bash
# Step 1: Generate the completion script (creates docker-completion.sh)
help-probe --generate-completion bash --output docker-completion.sh -- docker
# Step 2: Load it in your current session (enables tab completion)
source docker-completion.sh
# Step 3: Test it - type "docker <TAB>" to see subcommands, or "docker run --<TAB>" for options
# To make it permanent, add to ~/.bashrc:
# echo "source $(pwd)/docker-completion.sh" >> ~/.bashrc
# Zsh
help-probe --generate-completion zsh --output _cargo -- cargo
# Add to fpath: mv _cargo ~/.zsh/completions/ && echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc
# Then reload: source ~/.zshrc
# Fish
help-probe --generate-completion fish --output ~/.config/fish/completions/git.fish -- git
# Fish automatically loads completions from ~/.config/fish/completions/
# PowerShell
help-probe --generate-completion powershell --output podman-completion.ps1 -- podman
# Load in current session: . .\podman-completion.ps1
# Or add to PowerShell profile for persistence: Add-Content $PROFILE ". .\podman-completion.ps1"
# NuShell
help-probe --generate-completion nushell --output ~/.config/nushell/cargo-completion.nu -- cargo
# Add to config.nu: echo 'source ~/.config/nushell/cargo-completion.nu' >> ~/.config/nushell/config.nu
Note: Instead of --output, you can use shell redirection: help-probe --generate-completion bash -- docker > docker-completion.sh (in NuShell, use | save instead of >).
### Generate Command Builders
Generate type-safe command builder code that provides a fluent API for programmatically constructing CLI commands:
```bash
# Rust
help-probe --generate-builder rust --output docker_builder.rs -- docker
# Python
help-probe --generate-builder python --output git_builder.py -- git
# JavaScript/TypeScript
help-probe --generate-builder typescript --output cargo_builder.ts -- cargo
Use Case Example:
Instead of manually constructing command strings, use the generated builder for type-safe, IDE-autocompleted command construction:
# Before: Manual command construction (error-prone, no autocomplete)
import subprocess
subprocess.run(["docker", "run", "-d", "--name", "myapp", "-p", "8080:80", "nginx"])
# After: Using generated builder (type-safe, autocompleted)
from docker_builder import DockerBuilder
# Fluent API with autocomplete and type safety
result = DockerBuilder() \
.run() \
.detach() \
.name("myapp") \
.publish("8080:80") \
.image("nginx") \
.execute()
print(result.stdout)
// Rust example
use docker_builder::DockerBuilder;
let output = DockerBuilder::new()
.run()
.detach()
.name("myapp")
.publish("8080:80")
.image("nginx")
.execute()?;
This is especially useful for:
Generate API documentation in various formats:
# Markdown
help-probe --generate-api-docs markdown -- docker --help > docker.md
# HTML
help-probe --generate-api-docs html -- git --help > git.html
# OpenAPI 3.0
help-probe --generate-api-docs openapi -- cargo --help > cargo-openapi.json
# JSON Schema
help-probe --generate-api-docs jsonschema -- kubectl --help > kubectl-schema.json
Validate command invocations:
help-probe --validate -- docker run --image nginx
help-probe --validate -- git commit --message "test"
Discover all subcommands recursively:
help-probe --discover-all -- docker --help
help-probe --discover-all --max-depth 3 -- git --help
Cache is enabled by default. Control caching behavior:
# Disable cache
help-probe --no-cache -- ls --help
# Clear cache for a command
help-probe --clear-cache -- ls --help
# Use custom cache directory
help-probe --cache-dir /tmp/my-cache -- docker --help
Use help-probe as a library in your Rust projects:
use help_probe::{probe_command, ProbeConfig};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let config = ProbeConfig {
timeout_secs: 3,
require_help_flag: false,
cache: None, // Or Some(cache::CacheConfig::default())
};
let args = vec!["--help".to_string()];
let result = probe_command("ls", &args, &config).await?;
println!("Found {} options", result.options.len());
println!("Found {} subcommands", result.subcommands.len());
println!("Found {} arguments", result.arguments.len());
Ok(())
}
help_probe::parser - Parsing functions for help texthelp_probe::completion - Shell completion generationhelp_probe::builder - Command builder code generationhelp_probe::api_docs - API documentation generationhelp_probe::validation - Command validationhelp_probe::cache - Caching functionalityUSAGE:
help-probe [OPTIONS] -- <COMMAND> [ARGS...]
OPTIONS:
--cache-dir <DIR> Cache directory path (default: ~/.cache/help-probe)
--clear-cache Clear cache for the specified command
--discover-all Recursively discover all subcommands
--force Run command even when no help flag is present
--generate-api-docs <FORMAT> Generate API documentation (markdown, html, openapi, jsonschema)
--generate-builder <LANGUAGE> Generate command builder code (rust, python, javascript, typescript)
--generate-completion <SHELL> Generate shell completion script (bash, zsh, fish, powershell, nushell)
--output <FILE> Output file for completion/builder/docs (prompts if exists, use --force to skip)
--json Emit JSON instead of human-readable text
--max-depth <DEPTH> Maximum depth for recursive discovery (default: 5)
--no-cache Disable caching of probe results
--timeout-secs <SECS> Timeout in seconds for the target command (default: 3)
--validate Validate a command invocation
--verbose Show raw stdout/stderr from the command
-h, --help Print help information
-V, --version Print version information
The JSON output includes:
Generate completion scripts for any CLI tool automatically.
Provide autocomplete and validation for CLI commands in IDEs.
Validate command invocations before execution in test suites.
Auto-generate up-to-date documentation from help text.
Create type-safe wrappers around CLI tools.
Discover environment variables and generate config templates.
Validate and construct commands programmatically in automation scripts.
help-probe --generate-completion bash -- docker --help > /etc/bash_completion.d/docker
if help-probe --validate -- docker run --invalid-flag; then
echo "Command is valid"
else
echo "Command has errors"
exit 1
fi
help-probe --generate-builder python -- git --help > git_builder.py
# Then use it:
python -c "
from git_builder import GitBuilder
cmd = GitBuilder().add().file('test.txt').build()
print(cmd)
"
help-probe --discover-all --json -- docker --help | jq '.total_commands'
See CHANGELOG.md for a detailed list of changes, new features, and bug fixes.
If you're developing a CLI tool and want to ensure optimal compatibility with help-probe, see HELP_PROBE_SPEC.md for guidelines on formatting help output. This specification covers:
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)Please make sure to:
cargo fmt and cargo clippy before submittingThis project is dual-licensed under:
You may choose either license for your use. This dual-licensing approach is common in the Rust ecosystem and provides maximum flexibility for users and contributors.
Built with Rust for performance and reliability. Uses heuristic parsing to handle the wide variety of help text formats in the wild.