8000 [WIP] `dotnet tool exec <package[@version]>` one-shot execution by edvilme · Pull Request #48443 · dotnet/sdk · GitHub
[go: up one dir, main page]

Skip to content

[WIP] dotnet tool exec <package[@version]> one-shot execution #48443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
bb4b2bc
Add command
edvilme Apr 11, 2025
dd02918
Add logic for acquisition and running
edvilme Apr 14, 2025
62cc62c
Execute tool
edvilme Apr 14, 2025
87d8208
Load package if installed
edvilme Apr 14, 2025
b11e3b8
tool-run: --from-source
edvilme Apr 15, 2025
2902f08
Save tool to temp directory
edvilme Apr 15, 2025
33443f1
Update translations
edvilme Apr 15, 2025
e603952
Update cli snapshots
edvilme Apr 15, 2025
d9ab4d8
Merge branch 'main' into edvilme-toolx
edvilme Apr 15, 2025
786d58b
Address pr comments
edvilme Apr 16, 2025
51e3412
Merge branch 'edvilme-toolx' of https://github.com/edvilme/sdk into e…
edvilme Apr 16, 2025
a51efbe
Fix typo
edvilme Apr 16, 2025
08b1431
Fix typo
edvilme Apr 16, 2025
66395d5
Move logic to ToolRunFromSourceCommand.cs
edvilme Apr 17, 2025
7e6b546
Merge branch 'main' into edvilme-toolx
edvilme Apr 17, 2025
dfb18b0
Add options
edvilme Apr 17, 2025
875889a
Merge branch 'edvilme-toolx' of https://github.com/edvilme/sdk into e…
edvilme Apr 17, 2025
d8a059a
Fix typo
edvilme Apr 17, 2025
4f30d19
Fix silly errors
edvilme Apr 17, 2025
a8dfe19
Run tool
edvilme Apr 17, 2025
630744c
Simplify code and translations
edvilme Apr 18, 2025
ee41f19
Update completions
edvilme Apr 18, 2025
f85411f
Add --interactive option
edvilme Apr 18, 2025
f14af9a
Update Completion snapshots
edvilme Apr 21, 2025
8d95185
tool-exec
edvilme Apr 21, 2025
90b197c
Update Completions
edvilme Apr 21, 2025
761ea9f
Merge branch 'main' into edvilme-toolx
edvilme Apr 22, 2025
6d2066a
Update cli snapshots
edvilme Apr 22, 2025
2573bad
Add version option
edvilme Apr 22, 2025
5de73ef
Pretty divider line
edvilme Apr 22, 2025
f4c558c
Address pr feedback
edvilme Apr 24, 2025
093f2e6
Merge branch 'main' into edvilme-toolx
edvilme Apr 28, 2025
45339d7
Remove prompt for normal and quiter verbosities
edvilme Apr 28, 2025
9d07213
Merge branch 'edvilme-toolx' of https://github.com/edvilme/sdk into e…
edvilme Apr 28, 2025
8936d4e
Store in nuget cache?
edvilme Apr 29, 2025
fcd119a
Merge branch 'main' into edvilme-toolx
edvilme Apr 30, 2025
76511ee
Merge branch 'main' into edvilme-toolx
edvilme May 13, 2025
52d9728
Remove null assignment
edvilme May 13, 2025
cbbf3da
Merge branch 'edvilme-toolx' of https://github.com/edvilme/sdk into e…
edvilme May 13, 2025
312f46f
Remove null assignment
edvilme May 13, 2025
0cb89cc
Merge branch 'main' into edvilme-toolx
marcpopMSFT Jun 6, 2025
62d20ad
Update based on PR feedback.
marcpopMSFT Jun 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add command
  • Loading branch information
edvilme committed Apr 15, 2025
commit bb4b2bc85a0b89404a9a4a600eac413e39c6348d
25 changes: 25 additions & 0 deletions src/Cli/dotnet/Commands/Tool/Runx/ToolRunxCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.CommandLine;
using Microsoft.DotNet.Cli.CommandFactory;
using Microsoft.DotNet.Cli.CommandFactory.CommandResolution;
using Microsoft.DotNet.Cli.Commands.Tool.Install;
using Microsoft.DotNet.Cli.ToolManifest;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.Extensions.EnvironmentAbstractions;
using Microsoft.DotNet.Cli.ToolPackage;
namespace Microsoft.DotNet.Cli.Commands.Tool.Runx;

internal class ToolRunxCommand(ParseResult result) : CommandBase(result)
{
private readonly string _toolCommandName = result.GetValue(ToolRunxCommandParser.CommandNameArgument);
private readonly IEnumerable<string> _forwardArgument = result.GetValue(ToolRunxCommandParser.CommandArgument);
public bool _allowRollForward = result.GetValue(ToolRunxCommandParser.RollForwardOption);

public override int Execute()
{
var tempDir = new DirectoryPath(PathUtilities.CreateTempSubdirectory());
return 0;
}
}
46 changes: 46 additions & 0 deletions src/Cli/dotnet/Commands/Tool/Runx/ToolRunxCommandParser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.CommandLine;

namespace Microsoft.DotNet.Cli.Commands.Tool.Runx;

internal static class ToolRunxCommandParser
{
public static readonly CliArgument<string> CommandNameArgument = new("commandName")
{
HelpName = CliCommandStrings.CommandNameArgumentName,
Description = CliCommandStrings.CommandNameArgumentDescription
};

public static readonly CliArgument<IEnumerable<string>> CommandArgument = new("toolArguments")
{
Description = "arguments forwarded to the tool"
};

public static readonly CliOption<bool> RollForwardOption = new("--allow-roll-forward")
{
Description = CliCommandStrings.RollForwardOptionDescription,
Arity = ArgumentArity.Zero
};

private static readonly CliCommand Command = ConstructCommand();

public static CliCommand GetCommand()
{
return Command;
}

private static CliCommand ConstructCommand()
{
CliCommand command = new("run", CliCommandStrings.ToolRunCommandDescription);

command.Arguments.Add(CommandNameArgument);
command.Arguments.Add(CommandArgument);
command.Options.Add(RollForwardOption);

command.SetAction((parseResult) => new ToolRunxCommand(parseResult).Execute());
B5BA
return command;
}
}
2 changes: 2 additions & 0 deletions src/Cli/dotnet/Commands/Tool/ToolCommandParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Microsoft.DotNet.Cli.Commands.Tool.List;
using Microsoft.DotNet.Cli.Commands.Tool.Restore;
using Microsoft.DotNet.Cli.Commands.Tool.Run;
using Microsoft.DotNet.Cli.Commands.Tool.Runx;
using Microsoft.DotNet.Cli.Commands.Tool.Search;
using Microsoft.DotNet.Cli.Commands.Tool.Uninstall;
using Microsoft.DotNet.Cli.Commands.Tool.Update;
Expand Down Expand Up @@ -35,6 +36,7 @@ private static CliCommand ConstructCommand()
command.Subcommands.Add(ToolRunCommandParser.GetCommand());
command.Subcommands.Add(ToolSearchCommandParser.GetCommand());
command.Subcommands.Add(ToolRestoreCommandParser.GetCommand());
command.Subcommands.Add(ToolRunxCommandParser.GetCommand());

command.SetAction((parseResult) => parseResult.HandleMissingCommand());

Expand Down
0