dev-proxy icon indicating copy to clipboard operation
dev-proxy copied to clipboard

Reorder options and subcommands to show alphabetically

Open waldekmastykarz opened this issue 9 months ago • 9 comments

When you run devproxy -h it shows the list of available options and subcommands. Both, are displayed in the order they're registered rather than alphabetically which complicates the lookup. Let's change the order to be alphabetical.

Image

waldekmastykarz avatar Mar 21 '25 13:03 waldekmastykarz

Can I handle this ? But, I've some issues when try to debug solution. I got a forked, cloned and try dotnet run build, no errors show but.

caiovlima avatar Mar 22 '25 19:03 caiovlima

Awesome! Please do! What kind of issues do you have?

waldekmastykarz avatar Mar 23 '25 09:03 waldekmastykarz

I started by installing Dev Proxy on my local machine using the link: Docs As you can see in the image, the Dev Proxy options are displayed.

Image

Next, I forked the project and cloned it into my local environment. I opened the project solution using Visual Studio, created a feature branch, and built the application.

However, I’m unable to debug it. When I run the application, the following terminal appears.

Image

Image

I know where the commands and subcommands for Dev Proxy are registered, but I want to see them when running my application. This way, I can change the order in which commands and subcommands are created and observe the results.

I have .NET versions 6, 8, and 9 installed.

Long Story Short: How can I view the options from devproxy -h based on the application running from my development environment, rather than the configuration set on my machine?

caiovlima avatar Mar 24 '25 01:03 caiovlima

You mentioned that you installed Dev Proxy first before you cloned the repo. I think what's happening, is that you're starting the installed version rather than the version from the cloned repo. I suggest that you uninstall Dev Proxy, then build it and start the version from the build output folder.

waldekmastykarz avatar Mar 27 '25 18:03 waldekmastykarz

@waldekmastykarz I uninstalled DevProxy, ran dotnet build, and verified the build output folder.

Image

I thought the .exe I should execute is this one, correct?

Image

It opens a terminal and indicates the local address to access, but when attempting to access it, an error is displayed.

Image

Image

caiovlima avatar Mar 31 '25 00:03 caiovlima

All is working fine! Dev Proxy is not a website you can access in a browser. You use it similarly to Fiddler where you configure it as a proxy on your machine and which the intercepts web requests from the applications.

waldekmastykarz avatar Mar 31 '25 04:03 waldekmastykarz

Got it! I know I need to change those lines to sort alphabetically. Here’s the link: https://github.com/dotnet/dev-proxy/blob/main/dev-proxy/ProxyHost.cs#L338

Once I’ve done that, I just want to make sure my changes actually worked. After building, how can I check it?

caiovlima avatar Mar 31 '25 16:03 caiovlima

After you build your project, run devproxy -h. Options and subcommands should show alphabetically sorted.

waldekmastykarz avatar Apr 01 '25 05:04 waldekmastykarz

Hey @caiovlima, are you still working on this?

waldekmastykarz avatar Apr 22 '25 06:04 waldekmastykarz

Opening up due to lack of response

waldekmastykarz avatar May 05 '25 11:05 waldekmastykarz

I am working on it.

I expect some refactoring of ProxyHost . Alphabetical sorting will be on our end, it does not look that System.CommandLine API has anything for this or will be in the next release (for now it is a v2-beta4 released 3 years ago).

bartizan avatar May 07 '25 08:05 bartizan