colacloud-cli 0.3.3__tar.gz → 0.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/PKG-INFO +1 -1
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/pyproject.toml +1 -1
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/src/colacloud_cli/formatters.py +10 -0
- colacloud_cli-0.3.4/tests/test_formatters.py +39 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/.github/workflows/ci.yml +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/.gitignore +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/AGENTS.md +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/LICENSE +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/README.md +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/scripts/smoke_test.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/src/colacloud_cli/__init__.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/src/colacloud_cli/api.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/src/colacloud_cli/commands/__init__.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/src/colacloud_cli/commands/avas.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/src/colacloud_cli/commands/barcode.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/src/colacloud_cli/commands/colas.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/src/colacloud_cli/commands/config.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/src/colacloud_cli/commands/permittees.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/src/colacloud_cli/commands/processing_times.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/src/colacloud_cli/commands/production_reports.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/src/colacloud_cli/commands/usage.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/src/colacloud_cli/commands/utils.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/src/colacloud_cli/config.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/src/colacloud_cli/main.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/tests/__init__.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/tests/test_api.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/tests/test_cli.py +0 -0
- {colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/tests/test_config.py +0 -0
|
@@ -494,6 +494,16 @@ def format_pagination(pagination: dict[str, Any], console: Console) -> None:
|
|
|
494
494
|
pages = pagination.get("pages", 1)
|
|
495
495
|
total = pagination.get("total", 0)
|
|
496
496
|
per_page = pagination.get("per_page", 20)
|
|
497
|
+
has_more = pagination.get("has_more")
|
|
498
|
+
|
|
499
|
+
if total is None:
|
|
500
|
+
msg = f"Showing page {page}"
|
|
501
|
+
if has_more is True:
|
|
502
|
+
msg += " (more results available)"
|
|
503
|
+
elif has_more is False:
|
|
504
|
+
msg += " (end of results)"
|
|
505
|
+
console.print(f"\n[dim]{msg}[/]")
|
|
506
|
+
return
|
|
497
507
|
|
|
498
508
|
# Calculate showing range
|
|
499
509
|
start = (page - 1) * per_page + 1
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from rich.console import Console
|
|
2
|
+
|
|
3
|
+
from colacloud_cli.formatters import format_pagination
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def _render_pagination(pagination: dict) -> str:
|
|
7
|
+
console = Console(record=True, width=100)
|
|
8
|
+
format_pagination(pagination, console)
|
|
9
|
+
return console.export_text()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_format_pagination_handles_unknown_total_with_more_results():
|
|
13
|
+
output = _render_pagination(
|
|
14
|
+
{
|
|
15
|
+
"mode": "offset",
|
|
16
|
+
"page": 1,
|
|
17
|
+
"per_page": 3,
|
|
18
|
+
"total": None,
|
|
19
|
+
"pages": None,
|
|
20
|
+
"has_more": True,
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
assert "Showing page 1 (more results available)" in output
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_format_pagination_handles_unknown_total_at_end():
|
|
28
|
+
output = _render_pagination(
|
|
29
|
+
{
|
|
30
|
+
"mode": "offset",
|
|
31
|
+
"page": 2,
|
|
32
|
+
"per_page": 3,
|
|
33
|
+
"total": None,
|
|
34
|
+
"pages": None,
|
|
35
|
+
"has_more": False,
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
assert "Showing page 2 (end of results)" in output
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{colacloud_cli-0.3.3 → colacloud_cli-0.3.4}/src/colacloud_cli/commands/production_reports.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|