Skip to content

Commit 74589be

Browse files
committed
Warn in CLI when --end precedes --start
An inverted window is a legal but empty range, so the request still runs; at the CLI it is almost always a typo, and the silent empty output gives no hint why. Signed-off-by: cwasicki <126617870+cwasicki@users.noreply.github.com>
1 parent 79a4090 commit 74589be

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎RELEASE_NOTES.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
## New Features
1212

13-
<!-- Here goes the main new features and examples or instructions on how to use them -->
13+
- The CLI now warns when `--end` is before `--start`. The request still runs, but the inverted range returns no data, so the warning flags what is almost always a typo.
1414

1515
## Bug Fixes
1616

‎src/frequenz/client/reporting/cli/__main__.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ def main() -> None:
107107
default=None,
108108
)
109109
args = parser.parse_args()
110+
# An inverted window is a legal but empty range; warn since at the CLI it is
111+
# almost always a typo.
112+
if args.start and args.end and args.end < args.start:
113+
print(
114+
"warning: --end is before --start; no data will be returned",
115+
file=sys.stderr,
116+
)
110117
asyncio.run(
111118
run(
112119
microgrid_id=args.mid,

0 commit comments

Comments
 (0)