Skip to content

Commit 3f6a212

Browse files
Use DotNet command template
1 parent 455c6b6 commit 3f6a212

18 files changed

+1501
-1336
lines changed

CSharpInteractive.HostApi/CSharpInteractive.HostApi.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535
<DependentUpon>CommandLines.tt</DependentUpon>
3636
</Compile>
3737

38-
<None Update="SimpleDotNetCommands.tt">
39-
<LastGenOutput>SimpleDotNetCommands.cs</LastGenOutput>
38+
<None Update="DotNetCommands.tt">
39+
<LastGenOutput>DotNetCommands.cs</LastGenOutput>
4040
<Generator>TextTemplatingFileGenerator</Generator>
4141
</None>
4242

43-
<Compile Update="SimpleDotNetCommands.cs">
43+
<Compile Update="DotNetCommands.cs">
4444
<AutoGen>True</AutoGen>
4545
<DesignTime>True</DesignTime>
46-
<DependentUpon>SimpleDotNetCommands.tt</DependentUpon>
46+
<DependentUpon>DotNetCommands.tt</DependentUpon>
4747
</Compile>
4848
</ItemGroup>
4949

CSharpInteractive.HostApi/CommandLines.cs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2857,6 +2857,74 @@ public partial record DotNetNuGetWhy: ICommandLine
28572857
public static DotNetNuGetWhy operator -(DotNetNuGetWhy command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars);
28582858
}
28592859

2860+
[ExcludeFromCodeCoverage]
2861+
public partial record DotNetNuConfigGet: ICommandLine
2862+
{
2863+
/// <summary>
2864+
/// Appends an argument.
2865+
/// </summary>
2866+
/// <param name="command">The command to which an argument will be added.</param>
2867+
/// <param name="arg">Argument to add.</param>
2868+
/// <returns>Returns a new command with the corresponding changes.</returns>
2869+
public static DotNetNuConfigGet operator +(DotNetNuConfigGet command, string arg) => command.AddArgs(arg);
2870+
2871+
/// <summary>
2872+
/// Removes an argument by its name.
2873+
/// </summary>
2874+
/// <param name="command">The command to which an argument will be removed.</param>
2875+
/// <param name="arg">Argument to remove.</param>
2876+
/// <returns>Returns a new command with the corresponding changes.</returns>
2877+
public static DotNetNuConfigGet operator -(DotNetNuConfigGet command, string arg) => command.RemoveArgs(arg);
2878+
2879+
/// <summary>
2880+
/// Appends arguments.
2881+
/// </summary>
2882+
/// <param name="command">The command to which arguments will be added.</param>
2883+
/// <param name="args">Arguments to add.</param>
2884+
/// <returns>Returns a new command with the corresponding changes.</returns>
2885+
public static DotNetNuConfigGet operator +(DotNetNuConfigGet command, IEnumerable<string> args) => command.AddArgs(args);
2886+
2887+
/// <summary>
2888+
/// Removes arguments by their name.
2889+
/// </summary>
2890+
/// <param name="command">The command to which arguments will be removed.</param>
2891+
/// <param name="args">Arguments to remove.</param>
2892+
/// <returns>Returns a new command with the corresponding changes.</returns>
2893+
public static DotNetNuConfigGet operator -(DotNetNuConfigGet command, IEnumerable<string> args) => command.RemoveArgs(args);
2894+
2895+
/// <summary>
2896+
/// Appends an environment variable.
2897+
/// </summary>
2898+
/// <param name="command">The command to which an environment variable will be added.</param>
2899+
/// <param name="var">Environment variable to add.</param>
2900+
/// <returns>Returns a new command with the corresponding changes.</returns>
2901+
public static DotNetNuConfigGet operator +(DotNetNuConfigGet command, (string name, string value) var) => command.AddVars(var);
2902+
2903+
/// <summary>
2904+
/// Removes environment variable by its name and value.
2905+
/// </summary>
2906+
/// <param name="command">The command to which an environment variable will be removed.</param>
2907+
/// <param name="var">Environment variable to remove.</param>
2908+
/// <returns>Returns a new command with the corresponding changes.</returns>
2909+
public static DotNetNuConfigGet operator -(DotNetNuConfigGet command, (string name, string value) var) => command.RemoveVars(var);
2910+
2911+
/// <summary>
2912+
/// Appends environment variables.
2913+
/// </summary>
2914+
/// <param name="command">The command to which environment variables will be added.</param>
2915+
/// <param name="vars">Environment variables to add.</param>
2916+
/// <returns>Returns a new command with the corresponding changes.</returns>
2917+
public static DotNetNuConfigGet operator +(DotNetNuConfigGet command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars);
2918+
2919+
/// <summary>
2920+
/// Removes environment variables by their name and value.
2921+
/// </summary>
2922+
/// <param name="command">The command to which environment variables will be removed.</param>
2923+
/// <param name="vars">environment variables to remove.</param>
2924+
/// <returns>Returns a new command with the corresponding changes.</returns>
2925+
public static DotNetNuConfigGet operator -(DotNetNuConfigGet command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars);
2926+
}
2927+
28602928
[ExcludeFromCodeCoverage]
28612929
public partial record DotNetPack: ICommandLine
28622930
{

CSharpInteractive.HostApi/CommandLines.tt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
<#@ import namespace="System.Linq" #>
2-
<#@ import namespace="System.Collections.Generic" #>
3-
<#@ import namespace="System.Text" #>
4-
// ReSharper disable InconsistentNaming
1+
// ReSharper disable InconsistentNaming
52
namespace HostApi;
63

74
<#
@@ -51,6 +48,7 @@ namespace HostApi;
5148
"DotNetNuGetTrustSource",
5249
"DotNetNuGetSign",
5350
"DotNetNuGetWhy",
51+
"DotNetNuConfigGet",
5452
"DotNetPack",
5553
"DotNetPublish",
5654
"DotNetRestore",

CSharpInteractive.HostApi/DotNetBuildServer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public enum DotNetBuildServer
2727

2828
internal static class DotNetBuildServerExtensions
2929
{
30-
public static string[] ToArgs(this IEnumerable<DotNetBuildServer> servers, string name) =>
30+
[SuppressMessage("ReSharper", "UnusedParameter.Global")]
31+
public static string[] ToArgs(this IEnumerable<DotNetBuildServer> servers, string name, string collectionSeparator) =>
3132
servers.Select(server => server switch
3233
{
3334
DotNetBuildServer.MSBuild => "--msbuild",

0 commit comments

Comments
 (0)