Skip to content

Commit f189b3e

Browse files
jpulgarinclaudeBartoszBlizniak
authored
fix: Add missing show_all parameter to entitlements list (#242) (#243)
* fix: Add missing show_all parameter to entitlements list (#242) The list_entitlements function was missing the show_all parameter that was added to the common_cli_list_options decorator in commit a959a5c. This caused the command to fail with a TypeError. - Add show_all parameter to list_entitlements function signature - Use paginate_results to properly handle show_all flag - Add test to verify the fix Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Update test suite and add changelog --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: Bartosz Blizniak <bblizniak@cloudsmith.io>
1 parent ff1690c commit f189b3e

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1111

1212
- Added support for deny policy management commands (list, create, get, update, delete)
1313

14+
### Fixed
15+
16+
- Entitlement token list command now fixed
1417

1518
## [1.9.4] - 2025-11-07
1619

cloudsmith_cli/cli/commands/entitlements.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import click
77

88
from ...core.api import entitlements as api
9+
from ...core.pagination import paginate_results
910
from .. import command, decorators, utils, validators
1011
from ..exceptions import handle_api_exceptions
1112
from ..utils import fmt_datetime, maybe_spinner
@@ -72,7 +73,7 @@ def wrapper(ctx, *args, **kwargs):
7273
return wrapper
7374

7475

75-
def list_entitlements(ctx, opts, owner_repo, page, page_size, show_tokens):
76+
def list_entitlements(ctx, opts, owner_repo, page, page_size, show_tokens, show_all):
7677
"""
7778
List entitlements for a repository.
7879
@@ -100,11 +101,13 @@ def list_entitlements(ctx, opts, owner_repo, page, page_size, show_tokens):
100101
context_msg = "Failed to get list of entitlements!"
101102
with handle_api_exceptions(ctx, opts=opts, context_msg=context_msg):
102103
with maybe_spinner(opts):
103-
entitlements_, page_info = api.list_entitlements(
104-
owner=owner,
105-
repo=repo,
104+
entitlements_, page_info = paginate_results(
105+
api.list_entitlements,
106+
show_all=show_all,
106107
page=page,
107108
page_size=page_size,
109+
owner=owner,
110+
repo=repo,
108111
show_tokens=show_tokens,
109112
)
110113

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import pytest
2+
3+
from ...commands.entitlements import list_ as list_entitlements
4+
5+
6+
@pytest.mark.usefixtures("set_api_key_env_var", "set_api_host_env_var")
7+
def test_entitlements_list_with_show_all(runner, organization, tmp_repository):
8+
"""Test listing entitlements with --show-all flag."""
9+
org_repo = f'{organization}/{tmp_repository["slug"]}'
10+
11+
# Minimal show-all success (no pagination args besides flag)
12+
result = runner.invoke(
13+
list_entitlements,
14+
args=[org_repo, "--show-all"],
15+
catch_exceptions=False,
16+
)
17+
assert result.exit_code == 0
18+
assert "Getting list of entitlements" in result.output
19+
assert "OK" in result.output
20+
assert "Invalid value for '--show-all'" not in result.output

0 commit comments

Comments
 (0)