Skip to content

Add CliInfo page to gallery#131

Merged
LittleLittleCloud merged 13 commits intoRazorConsole:mainfrom
ParadiseFallen:System.CommandLine
Nov 17, 2025
Merged

Add CliInfo page to gallery#131
LittleLittleCloud merged 13 commits intoRazorConsole:mainfrom
ParadiseFallen:System.CommandLine

Conversation

@ParadiseFallen
Copy link
Collaborator

Partially solves #84 (bc im not sure of what type of information is required)

Now when you just run gallery it starts app (as before).
Now when you run gallery with debug-cli command it outputs debug info (i.e. razorconsole-gallery debug-cli).

Feel free to requrest exact debug information (with ways to gather it).

debug-cli outputs json (bc i thought it would be much easier to parse / navigate).
For example on my system it outputs

{
    "os": {
        "architecture": "X64",
        "description": "Microsoft Windows 10.0.26200",
        "framework": ".NET 8.0.22",
        "rid": "win-x64"
    },
    "culture": {
        "ui": "ru-RU",
        "current": "ru-RU"
    },
    "console": {
        "encoding": {
            "input": "Codepage - 866",
            "output": "Codepage - 866"
        },
        "redirection": {
            "inputRedirected": "False",
            "outputRedirected": "False",
            "errorRedirected": "False"
        },
        "size": {
            "window": {
                "x": "120",
                "y": "30"
            },
            "buffer": {
                "x": "120",
                "y": "30",
            }
        },
        "color": {
            "foreground": "Gray",
            "background": "Black"
        }
    }
}

I also added launchSettting.json to easilly test that command. Just set commandLineArgs to debug-cli and it will always lunch debug command when run

@LittleLittleCloud
Copy link
Member

LittleLittleCloud commented Nov 16, 2025

Can we add the debug info as a single page, like 'align', 'table' or other examples so that we don't need to add a command line option for that purpose.

We might also need to collect console capabilities information like 'Link'. This can be reserved for future work

@ParadiseFallen
Copy link
Collaborator Author

ParadiseFallen commented Nov 16, 2025

Can we add the debug info as a single page

Im afraid if someone report that gallery does not renders properly we can't relly on RazorConsole rendering. Also it's not a page in gallery because it's required in very few scenarios.

We might also need to collect console capabilities information like

Ill invistigate that.
What i found now is that it's impossible to get CLI runtime without dll imports.
Link is supported by CLI itself. So if we found out a way to gather terminal runtime we can say is it supported or not

@LittleLittleCloud
Copy link
Member

Spectre.Console have some utility method to get console capabilities. IIRC You can refer to 'AnsiConsole.Profile.Capabilities' to figure out the supported/enabled console capabilities, where Link should be one of them.

I would still prefer to make debug info as a separate page in gallery app for the following reasons

  • gallery app is the place to show best practices for razor console, so I would prefer to focus on razor console scenarios.
  • rendering totally broken is rare, we only see one case so far and the console/system information we collected from them is useless. The issue is reported to be resolved after they update razor console to a newer version. So I would imagine for 100% rendering broken case, manually collecting information is still necessary.
  • for small rendering issues, in most of cases it's because user didn't enable utf 8 or their console doesn't support link. I would imagine this is where debug info would be mostly useful for.

So, maybe instead of calling it debug info, calling it console info / system info and making it another page under gallery app might be more appropriate here?

@TeseySTD
Copy link
Member

TeseySTD commented Nov 16, 2025

  • user didn't enable utf 8

Maybe we should enable utf8 by default using System.Console?
I mean, it is pretty simple, I did it before in my project:

Console.OutputEncoding = System.Text.Encoding.UTF8;
Console.InputEncoding = System.Text.Encoding.UTF8;

debug info as a separate page

we can use some extra mode, using env variables, like you did in VDom Tree Visualization:

$env:RC_PRINT_VDOM_TREE="true"
dotnet run

that mode will give some simplified console output without any Spectre renerables.

@ParadiseFallen
Copy link
Collaborator Author

So.

  1. Change to page (pretty easy)
  2. Use Spectre.Console to gather capabilites (need a bit to research)

Ill update it a bit later

@ParadiseFallen
Copy link
Collaborator Author

Preview:
image

@ParadiseFallen
Copy link
Collaborator Author

yeah. icons does't work for me for some reason

@LittleLittleCloud
Copy link
Member

LittleLittleCloud commented Nov 17, 2025

You need to enable Unicode support for cli on your system as well

Check the doc below on how to enable it

https://spectreconsole.net/best-practices

@ParadiseFallen ParadiseFallen changed the title Add debug command to gallery Add CliInfo page to gallery Nov 17, 2025
@LittleLittleCloud LittleLittleCloud merged commit 3206094 into RazorConsole:main Nov 17, 2025
5 checks passed
@github-actions github-actions bot added this to the v0.2.0 milestone Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants