gamesheet_sdk.admin.cli.shared package¶
Shared CLI utilities.
- 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:
The decorated function with –format and –output options
- Return type:
F
- gamesheet_sdk.admin.cli.shared.get_fields_option(func)[source]¶
Add –fields option for get commands.
- Parameters:
func (F) – The Click command function to decorate
- Returns:
The decorated function with –fields option
- 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:
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:
Timezone offset in minutes
- Return type:
- gamesheet_sdk.admin.cli.shared.list_columns_option(func)[source]¶
Add –columns option for list commands.
- Parameters:
func (F) – The Click command function to decorate
- Returns:
The decorated function with –columns option
- Return type:
F
- gamesheet_sdk.admin.cli.shared.parse_flexible_datetime(raw)[source]¶
Parse a flexible datetime string into a naive datetime preserving face values.
Uses
dateutil.parser.parsefor flexible input. Any timezone information is stripped — the returned 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.- Parameters:
raw (str) – A human-readable datetime string
- Returns:
A timezone-naive datetime with the face-value time
- Return type:
datetime
- Raises:
click.UsageError – If the string cannot be parsed
- gamesheet_sdk.admin.cli.shared.render_get_command(data, output_format, output_path, fields_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
fields_spec (str | None) – Optional comma-separated field 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:
- Return type:
:returns:
(start_utc_iso, end_utc_iso)tuple :rtype: tuple[str, str] :raises click.UsageError: If fewer than 2 of 3 are provided, or if all 3 are inconsistent, or end <= start
- 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:
- Return type:
str | None
:param label:
"start"or"end", for error messages :type label: str :returns: A merged datetime string or None :rtype: str | None :raises click.UsageError: If only one of date/time is provided
- 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:
- Return type:
:returns:
(start_utc_iso, end_utc_iso)tuple :rtype: tuple[str, str]
- 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:
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:
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) – Start datetime (UTC)
end_dt (datetime) – End datetime (UTC)
- Raises:
click.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:
:param label:
"start"or"end", for error messages :type label: str :raises click.UsageError: If combined and any split input coexist