feat(cli): add comprehensive help system and fix ISO8601 confusion - #5
Merged
Conversation
Enhances CLI help output with detailed documentation for all commands: - Add separate TimeRangeRelativeOnly struct for metrics commands - Clarify that metrics do NOT support ISO8601 timestamps (only relative/Unix) - Add long_help with comprehensive examples for all arguments - Document query syntax for logs, spans, and metrics commands - Show required environment variables in main help output - Explain NDJSON output format with usage examples - Include links to official Datadog documentation README improvements: - Add Quick Start section for immediate value - Document pre-built binary downloads - Add cargo install/uninstall instructions - Consolidate time format documentation in Common Options - Add Output Format section with practical examples This makes the CLI fully self-discoverable for both humans and LLMs, eliminating the critical confusion where metrics commands appeared to support ISO8601 when they actually don't.
The Datadog metrics list API only accepts a start time parameter, but the command was incorrectly accepting both --from and --to using TimeRangeRelativeOnly. The --to parameter was silently ignored, leading to misleading behavior and logging. Created new TimeFrom struct that only accepts --from parameter, making the API constraint explicit at compile time. Updated help text to clearly document that only --from is available for this command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR significantly enhances the CLI help system to make
ddogfully self-discoverable, fixing a critical issue where metrics commands incorrectly showed ISO8601 support in help output despite not actually supporting it. All commands now provide comprehensive inline documentation with query syntax examples, time format guidance, and usage patterns.Problem
ddog --helpor command-specific help provided minimal guidanceThis made it difficult for both humans and LLMs to use the tool effectively without consulting external documentation.
Solution
Core Changes
1. Fixed ISO8601 Confusion (src/cli/shared.rs)
TimeRangeRelativeOnlystruct for metrics commands2. Comprehensive Help Text
Added detailed
long_helpattributes throughout:Each command includes:
jqintegration3. Enhanced README (README.md)
cargo install/uninstallmethodsImpact
For Users
ddog --helpandddog <command> <action> --helpprovide complete usage guidanceFor LLMs
--helpCode Quality
Examples
Before
After
Testing
Files Changed
src/cli/shared.rs(+110): NewTimeRangeRelativeOnlystructsrc/cli/metrics.rs(+103): Comprehensive help for metrics commandsREADME.md(+155, -50): Better structure, consolidated docssrc/cli/logs.rs(+58): Query syntax documentationsrc/cli/spans.rs(+50): APM query syntax documentationsrc/cli/args.rs(+25): Environment variables and examplessrc/commands/metrics/*.rs(+8): Use new time range structsrc/cli/mod.rs(+2): Export new typeTotal: 9 files, 461 insertions(+), 50 deletions(-)
Documentation
The CLI is now fully self-documenting. Users and LLMs can discover:
ddog --helpddog <domain> <action> --help🤖 Generated with Claude Code