Skip to content

Commit 1a444fc

Browse files
committed
Add "dotnet dnx" command
1 parent 590390a commit 1a444fc

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System.CommandLine;
5+
using Microsoft.DotNet.Cli.Commands.Tool;
6+
using Microsoft.DotNet.Cli.Commands.Tool.Execute;
7+
8+
namespace Microsoft.DotNet.Cli.Commands.Dnx;
9+
10+
internal static class DnxCommandParser
11+
{
12+
public static readonly Command Command = ConstructCommand();
13+
public static Command GetCommand()
14+
{
15+
return Command;
16+
}
17+
18+
private static Command ConstructCommand()
19+
{
20+
Command command = new("dnx", CliCommandStrings.ToolExecuteCommandDescription);
21+
command.Hidden = true;
22+
23+
foreach (var argument in ToolExecuteCommandParser.Command.Arguments)
24+
{
25+
command.Arguments.Add(argument);
26+
}
27+
28+
foreach (var option in ToolExecuteCommandParser.Command.Options)
29+
{
30+
command.Options.Add(option);
31+
}
32+
33+
command.SetAction((parseResult) => new ToolExecuteCommand(parseResult).Execute());
34+
35+
return command;
36+
}
37+
}

src/Cli/dotnet/Parser.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Microsoft.DotNet.Cli.Commands.Build;
1010
using Microsoft.DotNet.Cli.Commands.BuildServer;
1111
using Microsoft.DotNet.Cli.Commands.Clean;
12+
using Microsoft.DotNet.Cli.Commands.Dnx;
1213
using Microsoft.DotNet.Cli.Commands.Format;
1314
using Microsoft.DotNet.Cli.Commands.Fsi;
1415
using Microsoft.DotNet.Cli.Commands.Help;
@@ -65,6 +66,7 @@ public static class Parser
6566
BuildCommandParser.GetCommand(),
6667
BuildServerCommandParser.GetCommand(),
6768
CleanCommandParser.GetCommand(),
69+
DnxCommandParser.GetCommand(),
6870
FormatCommandParser.GetCommand(),
6971
CompleteCommandParser.GetCommand(),
7072
FsiCommandParser.GetCommand(),

0 commit comments

Comments
 (0)