File tree Expand file tree Collapse file tree 3 files changed +73
-0
lines changed
src/Cli/dotnet/Commands/Tool Expand file tree Collapse file tree 3 files changed +73
-0
lines changed Original file line number Diff line number Diff line change
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 . CommandFactory ;
6
+ using Microsoft . DotNet . Cli . CommandFactory . CommandResolution ;
7
+ using Microsoft . DotNet . Cli . Commands . Tool . Install ;
8
+ using Microsoft . DotNet . Cli . ToolManifest ;
9
+ using Microsoft . DotNet . Cli . Utils ;
10
+ using Microsoft . Extensions . EnvironmentAbstractions ;
11
+ using Microsoft . DotNet . Cli . ToolPackage ;
12
+ namespace Microsoft . DotNet . Cli . Commands . Tool . Runx ;
13
+
14
+ internal class ToolRunxCommand ( ParseResult result ) : CommandBase ( result )
15
+ {
16
+ private readonly string _toolCommandName = result . GetValue ( ToolRunxCommandParser . CommandNameArgument ) ;
17
+ private readonly IEnumerable < string > _forwardArgument = result . GetValue ( ToolRunxCommandParser . CommandArgument ) ;
18
+ public bool _allowRollForward = result . GetValue ( ToolRunxCommandParser . RollForwardOption ) ;
19
+
20
+ public override int Execute ( )
21
+ {
22
+ var tempDir = new DirectoryPath ( PathUtilities . CreateTempSubdirectory ( ) ) ;
23
+ return 0 ;
24
+ }
25
+ }
Original file line number Diff line number Diff line change
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
+
6
+ namespace Microsoft . DotNet . Cli . Commands . Tool . Runx ;
7
+
8
+ internal static class ToolRunxCommandParser
9
+ {
10
+ public static readonly CliArgument < string > CommandNameArgument = new ( "commandName" )
11
+ {
12
+ HelpName = CliCommandStrings . CommandNameArgumentName ,
13
+ Description = CliCommandStrings . CommandNameArgumentDescription
14
+ } ;
15
+
16
+ public static readonly CliArgument < IEnumerable < string > > CommandArgument = new ( "toolArguments" )
17
+ {
18
+ Description = "arguments forwarded to the tool"
19
+ } ;
20
+
21
+ public static readonly CliOption < bool > RollForwardOption = new ( "--allow-roll-forward" )
22
+ {
23
+ Description = CliCommandStrings . RollForwardOptionDescription ,
24
+ Arity = ArgumentArity . Zero
25
+ } ;
26
+
27
+ private static readonly CliCommand Command = ConstructCommand ( ) ;
28
+
29
+ public static CliCommand GetCommand ( )
30
+ {
31
+ return Command ;
32
+ }
33
+
34
+ private static CliCommand ConstructCommand ( )
35
+ {
36
+ CliCommand command = new ( "run" , CliCommandStrings . ToolRunCommandDescription ) ;
37
+
38
+ command . Arguments . Add ( CommandNameArgument ) ;
39
+ command . Arguments . Add ( CommandArgument ) ;
40
+ command . Options . Add ( RollForwardOption ) ;
41
+
42
+ command . SetAction ( ( parseResult ) => new ToolRunxCommand ( parseResult ) . Execute ( ) ) ;
43
+
44
+ return command ;
45
+ }
46
+ }
Original file line number Diff line number Diff line change 8
8
using Microsoft . DotNet . Cli . Commands . Tool . List ;
9
9
using Microsoft . DotNet . Cli . Commands . Tool . Restore ;
10
10
using Microsoft . DotNet . Cli . Commands . Tool . Run ;
11
+ using Microsoft . DotNet . Cli . Commands . Tool . Runx ;
11
12
using Microsoft . DotNet . Cli . Commands . Tool . Search ;
12
13
using Microsoft . DotNet . Cli . Commands . Tool . Uninstall ;
13
14
using Microsoft . DotNet . Cli . Commands . Tool . Update ;
@@ -37,6 +38,7 @@ private static Command ConstructCommand()
37
38
command . Subcommands . Add ( ToolRunCommandParser . GetCommand ( ) ) ;
38
39
command . Subcommands . Add ( ToolSearchCommandParser . GetCommand ( ) ) ;
39
40
command . Subcommands . Add ( ToolRestoreCommandParser . GetCommand ( ) ) ;
41
+ command . Subcommands . Add ( ToolRunxCommandParser . GetCommand ( ) ) ;
40
42
41
43
command . SetAction ( ( parseResult ) => parseResult . HandleMissingCommand ( ) ) ;
42
44
You can’t perform that action at this time.
0 commit comments