Skip to content

Commit dea8ed4

Browse files
Add new config command to easily open devproxyrc.json (#806)
* Add new config command to open devproxyrc.json * Add a debug launch setting * Improve config file path * Removes unnecessary using --------- Co-authored-by: Waldek Mastykarz <[email protected]>
1 parent 1dddb97 commit dea8ed4

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

dev-proxy/Properties/launchSettings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
"Missing arg": {
3838
"commandName": "Project",
3939
"commandLineArgs": "--port 8080 --summary-file-path report.md"
40+
},
41+
"Config": {
42+
"commandName": "Project",
43+
"commandLineArgs": "config"
4044
}
4145
}
4246
}

dev-proxy/ProxyHost.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Microsoft.DevProxy.Abstractions;
55
using Microsoft.Extensions.Logging;
66
using System.CommandLine;
7+
using System.Diagnostics;
78
using System.Net;
89

910
namespace Microsoft.DevProxy;
@@ -325,6 +326,17 @@ public RootCommand GetRootCommand(ILogger logger)
325326

326327
command.Add(presetCommand);
327328

329+
var configCommand = new Command("config", "Open devproxyrc.json");
330+
configCommand.SetHandler(() =>
331+
{
332+
var cfgPsi = new ProcessStartInfo(ConfigFile)
333+
{
334+
UseShellExecute = true
335+
};
336+
Process.Start(cfgPsi);
337+
});
338+
command.Add(configCommand);
339+
328340
var outdatedCommand = new Command("outdated", "Check for new version");
329341
var outdatedShortOption = new Option<bool>("--short", "Return version only");
330342
outdatedCommand.AddOption(outdatedShortOption);

0 commit comments

Comments
 (0)