Repository navigation
docs(cli): explain how to track a command in monitor --help - #1472
Merged
benoit-cty merged 1 commit intoOct 31, 2026
Merged
Conversation
benoit-cty
approved these changes
Oct 31, 2026
Contributor
|
Thanks, that was quick! |
benoit-cty
enabled auto-merge
October 31, 2026 17:54
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1472 +/- ##
=======================================
Coverage 93.66% 93.66%
=======================================
Files 50 50
Lines 5591 5591
=======================================
Hits 5237 5237
Misses 354 354 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
Thanks for the quick review and merge, Benoît! Glad the help text is now where users actually look first. |
3 of 6 tasks
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.
Description
codecarbon monitor --helponly printed "Monitor your machine's carbon emissions.", so the CLI never explained thatmonitoralso wraps a command when arguments follow--.That behaviour already exists —
monitor()delegates torun_and_monitor()when extra args are present — andcodecarbon/cli/monitor.pydocuments the patterns. Only the help text was missing. This adds a short overview line, the usage form, and a link to the "Track any command" section of the CLI tutorial.Related Issue
Fixes #1470
Motivation and Context
uvx codecarbon monitor --helpis the first place a user looks, but the documented feature at https://docs.codecarbon.io/latest/tutorials/cli/#track-any-command was invisible there.Before:
After:
How Has This Been Tested?
uv run codecarbon monitor --helpbefore the change (missing text) and after it, and checked the rendered help at several terminal widths.test_monitor_help_explains_running_a_commandintests/cli/test_cli_main.py. It fails without the docstring change and passes with it.uv run pytest tests/cli --basetemp=...: 80 passed. (The--basetempis only because the default pytest temp directory is not writable on this Windows machine; unrelated to the change.)uv run pre-commit run --files codecarbon/cli/main.py tests/cli/test_cli_main.py: autoflake, isort, black, flake8 pass.Types of changes
Documentation-only change to the CLI help text; none of the three boxes below apply.
AI Usage Disclosure
The docstring wording, the test and this description were drafted with an AI assistant. I reviewed the diff, ran the command and the tests myself, and can explain the change: Typer renders the command docstring as the long help text, and the
--delegation torun_and_monitor()was already implemented inmonitor()— only the text was missing.Checklist:
tests/clipassed.