systemlink-cli 1.3.1__py3-none-any.whl
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.
- slcli/__init__.py +1 -0
- slcli/__main__.py +23 -0
- slcli/_version.py +4 -0
- slcli/asset_click.py +1289 -0
- slcli/cli_formatters.py +218 -0
- slcli/cli_utils.py +504 -0
- slcli/comment_click.py +602 -0
- slcli/completion_click.py +418 -0
- slcli/config.py +81 -0
- slcli/config_click.py +498 -0
- slcli/dff_click.py +979 -0
- slcli/dff_decorators.py +24 -0
- slcli/example_click.py +404 -0
- slcli/example_loader.py +274 -0
- slcli/example_provisioner.py +2777 -0
- slcli/examples/README.md +134 -0
- slcli/examples/_schema/schema-v1.0.json +169 -0
- slcli/examples/demo-complete-workflow/README.md +323 -0
- slcli/examples/demo-complete-workflow/config.yaml +638 -0
- slcli/examples/demo-test-plans/README.md +132 -0
- slcli/examples/demo-test-plans/config.yaml +154 -0
- slcli/examples/exercise-5-1-parametric-insights/README.md +101 -0
- slcli/examples/exercise-5-1-parametric-insights/config.yaml +1589 -0
- slcli/examples/exercise-7-1-test-plans/README.md +93 -0
- slcli/examples/exercise-7-1-test-plans/config.yaml +323 -0
- slcli/examples/spec-compliance-notebooks/README.md +140 -0
- slcli/examples/spec-compliance-notebooks/config.yaml +112 -0
- slcli/examples/spec-compliance-notebooks/notebooks/SpecAnalysis_ComplianceCalculation.ipynb +1553 -0
- slcli/examples/spec-compliance-notebooks/notebooks/SpecComplianceCalculation.ipynb +1577 -0
- slcli/examples/spec-compliance-notebooks/notebooks/SpecfileExtractionAndIngestion.ipynb +912 -0
- slcli/examples/spec-compliance-notebooks/spec_template.xlsx +0 -0
- slcli/feed_click.py +892 -0
- slcli/file_click.py +932 -0
- slcli/function_click.py +1400 -0
- slcli/function_templates.py +85 -0
- slcli/main.py +406 -0
- slcli/mcp_click.py +269 -0
- slcli/mcp_server.py +748 -0
- slcli/notebook_click.py +1770 -0
- slcli/platform.py +345 -0
- slcli/policy_click.py +679 -0
- slcli/policy_utils.py +411 -0
- slcli/profiles.py +411 -0
- slcli/response_handlers.py +359 -0
- slcli/routine_click.py +763 -0
- slcli/skill_click.py +253 -0
- slcli/skills/slcli/SKILL.md +713 -0
- slcli/skills/slcli/references/analysis-recipes.md +474 -0
- slcli/skills/slcli/references/filtering.md +236 -0
- slcli/skills/systemlink-webapp/SKILL.md +744 -0
- slcli/skills/systemlink-webapp/references/deployment.md +123 -0
- slcli/skills/systemlink-webapp/references/nimble-angular.md +380 -0
- slcli/skills/systemlink-webapp/references/systemlink-services.md +192 -0
- slcli/ssl_trust.py +93 -0
- slcli/system_click.py +2216 -0
- slcli/table_utils.py +124 -0
- slcli/tag_click.py +794 -0
- slcli/templates_click.py +599 -0
- slcli/testmonitor_click.py +1667 -0
- slcli/universal_handlers.py +305 -0
- slcli/user_click.py +1218 -0
- slcli/utils.py +832 -0
- slcli/web_editor.py +295 -0
- slcli/webapp_click.py +981 -0
- slcli/workflow_preview.py +287 -0
- slcli/workflows_click.py +988 -0
- slcli/workitem_click.py +2258 -0
- slcli/workspace_click.py +576 -0
- slcli/workspace_utils.py +206 -0
- systemlink_cli-1.3.1.dist-info/METADATA +20 -0
- systemlink_cli-1.3.1.dist-info/RECORD +74 -0
- systemlink_cli-1.3.1.dist-info/WHEEL +4 -0
- systemlink_cli-1.3.1.dist-info/entry_points.txt +7 -0
- systemlink_cli-1.3.1.dist-info/licenses/LICENSE +21 -0
slcli/table_utils.py
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"""Table formatting utilities for CLI commands."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from typing import Any, Callable, Dict, List
|
|
5
|
+
|
|
6
|
+
import click
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def output_formatted_list(
|
|
10
|
+
items: List[Dict[str, Any]],
|
|
11
|
+
output_format: str,
|
|
12
|
+
headers: List[str],
|
|
13
|
+
column_widths: List[int],
|
|
14
|
+
row_formatter_func: Callable[[Dict[str, Any]], List[str]],
|
|
15
|
+
empty_message: str = "No items found.",
|
|
16
|
+
total_label: str = "item(s)",
|
|
17
|
+
) -> None:
|
|
18
|
+
"""Handle JSON and table output with box-drawing characters for list commands.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
items: List of items to output
|
|
22
|
+
output_format: 'json' or 'table'
|
|
23
|
+
headers: List of header names for table output
|
|
24
|
+
column_widths: List of column widths for table formatting
|
|
25
|
+
row_formatter_func: Function that converts item to list of column values
|
|
26
|
+
empty_message: Message to display when no items are found
|
|
27
|
+
total_label: Label for total count (e.g., "configuration(s)", "template(s)")
|
|
28
|
+
"""
|
|
29
|
+
if not items:
|
|
30
|
+
if output_format.lower() == "json":
|
|
31
|
+
click.echo("[]")
|
|
32
|
+
else:
|
|
33
|
+
click.echo(empty_message)
|
|
34
|
+
return
|
|
35
|
+
|
|
36
|
+
if output_format.lower() == "json":
|
|
37
|
+
click.echo(json.dumps(items, indent=2))
|
|
38
|
+
return
|
|
39
|
+
|
|
40
|
+
# Table format with box-drawing characters
|
|
41
|
+
if len(headers) != len(column_widths):
|
|
42
|
+
raise ValueError("Headers and column_widths must have the same length")
|
|
43
|
+
|
|
44
|
+
_draw_table_border(column_widths, "top")
|
|
45
|
+
_draw_table_header(headers, column_widths)
|
|
46
|
+
_draw_table_border(column_widths, "middle")
|
|
47
|
+
_draw_table_rows(items, row_formatter_func, column_widths)
|
|
48
|
+
_draw_table_border(column_widths, "bottom")
|
|
49
|
+
|
|
50
|
+
# Total count
|
|
51
|
+
click.echo(f"\nTotal: {len(items)} {total_label}")
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _draw_table_border(column_widths: List[int], border_type: str) -> None:
|
|
55
|
+
"""Draw table borders with appropriate characters."""
|
|
56
|
+
if border_type == "top":
|
|
57
|
+
left, junction, right = "┌", "┬", "┐"
|
|
58
|
+
elif border_type == "middle":
|
|
59
|
+
left, junction, right = "├", "┼", "┤"
|
|
60
|
+
elif border_type == "bottom":
|
|
61
|
+
left, junction, right = "└", "┴", "┘"
|
|
62
|
+
else:
|
|
63
|
+
raise ValueError("Invalid border_type")
|
|
64
|
+
|
|
65
|
+
border_chars = [left] + [("─" * (w + 2)) for w in column_widths]
|
|
66
|
+
border_line = border_chars[0] + border_chars[1]
|
|
67
|
+
for part in border_chars[2:]:
|
|
68
|
+
border_line += junction + part
|
|
69
|
+
border_line += right
|
|
70
|
+
click.echo(border_line)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _draw_table_header(headers: List[str], column_widths: List[int]) -> None:
|
|
74
|
+
"""Draw table header row."""
|
|
75
|
+
header_parts = ["│"]
|
|
76
|
+
for header, width in zip(headers, column_widths):
|
|
77
|
+
header_parts.append(f" {header:<{width}} │")
|
|
78
|
+
click.echo("".join(header_parts))
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _draw_table_rows(
|
|
82
|
+
items: List[Dict[str, Any]],
|
|
83
|
+
row_formatter_func: Callable[[Dict[str, Any]], List[str]],
|
|
84
|
+
column_widths: List[int],
|
|
85
|
+
) -> None:
|
|
86
|
+
"""Draw table data rows."""
|
|
87
|
+
for item in items:
|
|
88
|
+
row_data = row_formatter_func(item)
|
|
89
|
+
if len(row_data) != len(column_widths):
|
|
90
|
+
raise ValueError("Row data must match column count")
|
|
91
|
+
|
|
92
|
+
row_parts = ["│"]
|
|
93
|
+
for value, width in zip(row_data, column_widths):
|
|
94
|
+
# Truncate if necessary
|
|
95
|
+
str_value = str(value or "")[:width]
|
|
96
|
+
row_parts.append(f" {str_value:<{width}} │")
|
|
97
|
+
click.echo("".join(row_parts))
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
class TableConfig:
|
|
101
|
+
"""Configuration class for standardized table layouts."""
|
|
102
|
+
|
|
103
|
+
# Standard column configurations
|
|
104
|
+
WORKSPACE_NAME_CONFIG_ID = {
|
|
105
|
+
"headers": ["Workspace", "Name", "Configuration ID"],
|
|
106
|
+
"widths": [36, 40, 36],
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
WORKSPACE_NAME_KEY = {"headers": ["Workspace", "Name", "Key"], "widths": [23, 32, 39]}
|
|
110
|
+
|
|
111
|
+
WORKSPACE_RESOURCE_TABLE = {
|
|
112
|
+
"headers": ["Workspace", "Resource Type", "Resource ID", "Table ID"],
|
|
113
|
+
"widths": [36, 30, 18, 36],
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
WORKSPACE_NAME_ID = {"headers": ["Workspace", "Name", "ID"], "widths": [36, 40, 36]}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def get_table_config(config_name: str) -> Dict[str, List]:
|
|
120
|
+
"""Get predefined table configuration by name."""
|
|
121
|
+
config = getattr(TableConfig, config_name, None)
|
|
122
|
+
if not config:
|
|
123
|
+
raise ValueError(f"Unknown table configuration: {config_name}")
|
|
124
|
+
return config
|