gamesheet_sdk.admin.cli.shared package¶
Shared CLI utilities.
- gamesheet_sdk.admin.cli.shared.columns_option(func)[source]¶
Add the –columns option that restricts output to a subset of keys.
One option covers both shapes of output: on a
listit selects table columns, and on aget/create/updateit selects fields of the single rendered object. Both are “show me only these keys”, so there is one name for it, and-fis left to mean--forceeverywhere.- Parameters:
func (F) – The Click command function to decorate.
- Returns:
F – The decorated function with the –columns option.
- Return type:
F
- gamesheet_sdk.admin.cli.shared.common_output_options(func)[source]¶
Add standard –format and –output options to command.
- Parameters:
func (F) – The Click command function to decorate
- Returns:
F – The decorated function with –format and –output options
- Return type:
F
- gamesheet_sdk.admin.cli.shared.get_local_timezone_name()[source]¶
Get the local system timezone name (IANA format).
Returns the timezone name like ‘America/New_York’, ‘UTC’, etc. Falls back to ‘UTC’ if unable to determine.
- Returns:
str – IANA timezone name
- Return type:
- gamesheet_sdk.admin.cli.shared.get_local_timezone_offset()[source]¶
Get the local timezone offset in minutes from UTC.
Returns the offset as a signed integer (negative for west of UTC, positive for east). For example, EDT (UTC-4) returns -240.
- Returns:
int – Timezone offset in minutes
- Return type:
- gamesheet_sdk.admin.cli.shared.parse_flexible_datetime(raw)[source]¶
Parse a flexible datetime string into a naive datetime.datetime preserving face values.
Uses
dateutil.parser.parsefor flexible input. Any timezone information is stripped — the returned datetime.datetime contains the literal hour/minute/second the user typed. This matches GameSheet’s API behavior, which stores and displays time values as-is without timezone conversion.
- gamesheet_sdk.admin.cli.shared.player_update_options(func)[source]¶
Add common player update options.
- Parameters:
func (F) – The Click command function to decorate
- Returns:
F – The decorated function with player update options
- Return type:
F
- gamesheet_sdk.admin.cli.shared.render_get_command(data, output_format, output_path, columns_spec=None)[source]¶
Render get command output (single object as key-value pairs).
- Parameters:
data (dict[str, Any] | BaseModel) – The object to render (dict or pydantic model)
output_format (str) – Output format (json, yaml, csv, tsv, or tabulate format)
output_path (str | None) – Optional file path to write output to
columns_spec (str | None) – Optional comma-separated column names to include
- gamesheet_sdk.admin.cli.shared.render_list_command(items, output_format, output_path, columns_spec=None)[source]¶
Render list command output (table of objects).
- Parameters:
- gamesheet_sdk.admin.cli.shared.render_penalty_report(report, output_format, output_path)[source]¶
Render penalty report output.
- gamesheet_sdk.admin.cli.shared.resolve_create_times(start_raw, end_raw, duration)[source]¶
Resolve start/end for create: exactly 2 of 3 required.
- Parameters:
- Returns:
tuple[str, str] –
(start_utc_iso, end_utc_iso)tuple- Raises:
UsageError – If fewer than 2 of 3 are provided, or if all 3 are inconsistent, or end <= start
- Return type:
- gamesheet_sdk.admin.cli.shared.resolve_datetime_input(combined, date_part, time_part, label)[source]¶
Merge split date+time inputs into one string, or return combined.
- Parameters:
- Returns:
str | None – A merged datetime string or None
- Raises:
UsageError – If only one of date/time is provided
- Return type:
str | None
- gamesheet_sdk.admin.cli.shared.resolve_update_times(start_raw, end_raw, duration, current_start, current_end)[source]¶
Resolve start/end for update: partial inputs OK.
Uses current game values as fallback when the user provides fewer than 2 inputs.
- Parameters:
- Returns:
tuple[str, str] –
(start_utc_iso, end_utc_iso)tuple- Return type:
- gamesheet_sdk.admin.cli.shared.team_create_options(func)[source]¶
Add common team create options.
- Parameters:
func (F) – The Click command function to decorate
- Returns:
F – The decorated function with team create options
- Return type:
F
- gamesheet_sdk.admin.cli.shared.team_update_options(func)[source]¶
Add common team update options.
- Parameters:
func (F) – The Click command function to decorate
- Returns:
F – The decorated function with team update options
- Return type:
F
- gamesheet_sdk.admin.cli.shared.validate_end_after_start(start_dt, end_dt)[source]¶
Raise if end is not strictly after start.
- Parameters:
start_dt (datetime.datetime) – Start datetime.datetime (UTC)
end_dt (datetime.datetime) – End datetime.datetime (UTC)
- Raises:
UsageError – If end <= start
- gamesheet_sdk.admin.cli.shared.validate_no_input_conflict(combined, date_part, time_part, label)[source]¶
Raise if combined and split inputs are both provided.
- Parameters:
- Raises:
UsageError – If combined and any split input coexist