gamesheet_sdk.teams.cli.helpers module¶
CLI helper functions for the teams dashboard.
- gamesheet_sdk.teams.cli.helpers.build_authenticated_session(config)[source]¶
Build a TeamsAuthenticatedSession from saved tokens.
- Parameters:
config (Config) – The application config.
- Returns:
TeamsAuthenticatedSession – A TeamsAuthenticatedSession ready to use.
- Raises:
Exit – If no tokens are saved.
- Return type:
- gamesheet_sdk.teams.cli.helpers.run_action_or_exit(session, action, *args, **kwargs)[source]¶
Run an action function with error handling.
Wraps the action call in the session’s context manager and catches
AuthenticationErrorandGameSheetError. On either exception, prints a user-friendly error message to stderr and exits with code 1. The session context manager ensures proper cleanup (e.g., closing connections) regardless of success or failure.- Parameters:
session (BaseAuthenticatedSession) – The authenticated session to use as a context manager.
action (Callable[..., _R]) – A callable that takes
sessionand*argsand returns a result. Typically a domain action function (e.g.,list_associations).*args (object) – Positional arguments forwarded to
actionaftersession.**kwargs (object) – Keyword arguments forwarded to
action.
- Returns:
_R – The result of
action(session, *args, **kwargs)on success.- Raises:
Exit – If
actionraisesAuthenticationErrororGameSheetError. Exit code is 1 in both cases.- Return type:
_R