|
5 | 5 |
|
6 | 6 | import typer |
7 | 7 | from rich import print |
| 8 | +from rich.syntax import Syntax |
8 | 9 |
|
9 | 10 | from cppython.configuration import ConfigurationLoader |
10 | 11 | from cppython.console.schema import ConsoleConfiguration, ConsoleInterface |
11 | | -from cppython.core.schema import ProjectConfiguration |
| 12 | +from cppython.core.schema import PluginReport, ProjectConfiguration |
12 | 13 | from cppython.project import Project |
13 | 14 |
|
14 | 15 | app = typer.Typer(no_args_is_help=True) |
@@ -124,9 +125,41 @@ def main( |
124 | 125 |
|
125 | 126 | @app.command() |
126 | 127 | def info( |
127 | | - _: typer.Context, |
| 128 | + context: typer.Context, |
128 | 129 | ) -> None: |
129 | | - """Prints project information""" |
| 130 | + """Prints project information including plugin configuration, managed files, and templates.""" |
| 131 | + project = get_enabled_project(context) |
| 132 | + project_info = project.info() |
| 133 | + |
| 134 | + if not project_info: |
| 135 | + return |
| 136 | + |
| 137 | + for role in ('provider', 'generator'): |
| 138 | + entry = project_info.get(role) |
| 139 | + if entry is None: |
| 140 | + continue |
| 141 | + |
| 142 | + name: str = entry['name'] |
| 143 | + report: PluginReport = entry['report'] |
| 144 | + |
| 145 | + print(f'\n[bold]{role.title()}:[/bold] {name}') |
| 146 | + |
| 147 | + if report.configuration: |
| 148 | + print(' [bold]Configuration:[/bold]') |
| 149 | + for key, value in report.configuration.items(): |
| 150 | + print(f' {key}: {value}') |
| 151 | + |
| 152 | + if report.managed_files: |
| 153 | + print(' [bold]Managed files:[/bold]') |
| 154 | + for path in report.managed_files: |
| 155 | + print(f' {path}') |
| 156 | + |
| 157 | + if report.template_files: |
| 158 | + print(' [bold]Templates:[/bold]') |
| 159 | + for filename, content in report.template_files.items(): |
| 160 | + print(f' [cyan]{filename}[/cyan]') |
| 161 | + print() |
| 162 | + print(Syntax(content, 'python', theme='monokai', line_numbers=True)) |
130 | 163 |
|
131 | 164 |
|
132 | 165 | @app.command() |
|
0 commit comments