зеркало из https://github.com/microsoft/PSRule.git
Родитель
308a89b488
Коммит
49d1193e70
16
PSRule.sln
16
PSRule.sln
|
@ -15,7 +15,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.BuildTool", "src\PSR
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.SDK", "src\PSRule.SDK\PSRule.SDK.csproj", "{07A84E67-1CA3-4766-B9EA-1FDD9DF6516F}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.Tool", "src\PSRule.Tool\PSRule.Tool.csproj", "{F6CFCA60-72D5-474E-8B8B-1AB973434569}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.Tool", "src\PSRule.Tool\PSRule.Tool.csproj", "{BDDBFDB8-614F-4B8A-930C-DCB60144598C}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F5173A23-CCEA-4C39-AB8D-EF6E86C11BD7}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
|
@ -30,6 +30,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{E0EA0CBA
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.Tool.Tests", "tests\PSRule.Tool.Tests\PSRule.Tool.Tests.csproj", "{DA46C891-08F1-4D01-9F98-1F8BB10CAFEC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.CommandLine", "src\PSRule.CommandLine\PSRule.CommandLine.csproj", "{9A556814-8E9D-4C76-8F6D-1AF2DA23A9E0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -60,10 +62,10 @@ Global
|
|||
{07A84E67-1CA3-4766-B9EA-1FDD9DF6516F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{07A84E67-1CA3-4766-B9EA-1FDD9DF6516F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{07A84E67-1CA3-4766-B9EA-1FDD9DF6516F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F6CFCA60-72D5-474E-8B8B-1AB973434569}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F6CFCA60-72D5-474E-8B8B-1AB973434569}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F6CFCA60-72D5-474E-8B8B-1AB973434569}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F6CFCA60-72D5-474E-8B8B-1AB973434569}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BDDBFDB8-614F-4B8A-930C-DCB60144598C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BDDBFDB8-614F-4B8A-930C-DCB60144598C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BDDBFDB8-614F-4B8A-930C-DCB60144598C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BDDBFDB8-614F-4B8A-930C-DCB60144598C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5FE4DB0B-63D1-4DDB-9762-9C0D29168BC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5FE4DB0B-63D1-4DDB-9762-9C0D29168BC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5FE4DB0B-63D1-4DDB-9762-9C0D29168BC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
@ -76,6 +78,10 @@ Global
|
|||
{DA46C891-08F1-4D01-9F98-1F8BB10CAFEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DA46C891-08F1-4D01-9F98-1F8BB10CAFEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DA46C891-08F1-4D01-9F98-1F8BB10CAFEC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9A556814-8E9D-4C76-8F6D-1AF2DA23A9E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9A556814-8E9D-4C76-8F6D-1AF2DA23A9E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9A556814-8E9D-4C76-8F6D-1AF2DA23A9E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9A556814-8E9D-4C76-8F6D-1AF2DA23A9E0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -29,6 +29,9 @@ See [upgrade notes][1] for helpful information when upgrading from previous vers
|
|||
|
||||
What's changed since pre-release v3.0.0-B0141:
|
||||
|
||||
- General improvements:
|
||||
- Improved support for packaging with Visual Studio Code by @BernieWhite.
|
||||
[#1755](https://github.com/microsoft/PSRule/issues/1755)
|
||||
- Engineering:
|
||||
- **Breaking change:** Bump development tools to .NET 8.0 SDK by @BernieWhite.
|
||||
[#1673](https://github.com/microsoft/PSRule/pull/1673)
|
||||
|
|
|
@ -4,10 +4,21 @@
|
|||
using System.CommandLine.Invocation;
|
||||
using PSRule.Configuration;
|
||||
|
||||
namespace PSRule.Tool;
|
||||
namespace PSRule.CommandLine;
|
||||
|
||||
internal sealed class ClientContext
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public sealed class ClientContext
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="invocation"></param>
|
||||
/// <param name="option"></param>
|
||||
/// <param name="verbose"></param>
|
||||
/// <param name="debug"></param>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public ClientContext(InvocationContext invocation, string? option, bool verbose, bool debug)
|
||||
{
|
||||
Path = AppDomain.CurrentDomain.BaseDirectory;
|
||||
|
@ -18,16 +29,34 @@ internal sealed class ClientContext
|
|||
Option = GetOption(Host, option);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Path { get; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public InvocationContext Invocation { get; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public ClientHost Host { get; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public PSRuleOption Option { get; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool Verbose { get; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool Debug { get; }
|
||||
|
||||
private static PSRuleOption GetOption(ClientHost host, string? path)
|
|
@ -4,7 +4,7 @@
|
|||
using System.CommandLine;
|
||||
using System.CommandLine.IO;
|
||||
|
||||
namespace PSRule.Tool;
|
||||
namespace PSRule.CommandLine;
|
||||
|
||||
internal static class ClientContextExtensions
|
||||
{
|
|
@ -6,9 +6,12 @@ using System.CommandLine.IO;
|
|||
using System.Management.Automation;
|
||||
using PSRule.Pipeline;
|
||||
|
||||
namespace PSRule.Tool;
|
||||
namespace PSRule.CommandLine;
|
||||
|
||||
internal sealed class ClientHost : HostContext
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public sealed class ClientHost : HostContext
|
||||
{
|
||||
private readonly ClientContext _Context;
|
||||
private readonly bool _Verbose;
|
||||
|
@ -16,6 +19,12 @@ internal sealed class ClientHost : HostContext
|
|||
private readonly ConsoleColor _BackgroundColor;
|
||||
private readonly ConsoleColor _ForegroundColor;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="verbose"></param>
|
||||
/// <param name="debug"></param>
|
||||
public ClientHost(ClientContext context, bool verbose, bool debug)
|
||||
{
|
||||
_Context = context;
|
||||
|
@ -27,6 +36,11 @@ internal sealed class ClientHost : HostContext
|
|||
Verbose($"Using working path: {Directory.GetCurrentDirectory()}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="variableName"></param>
|
||||
/// <returns></returns>
|
||||
public override ActionPreference GetPreferenceVariable(string variableName)
|
||||
{
|
||||
if (variableName == "VerbosePreference")
|
||||
|
@ -38,22 +52,40 @@ internal sealed class ClientHost : HostContext
|
|||
return base.GetPreferenceVariable(variableName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="errorRecord"></param>
|
||||
public override void Error(ErrorRecord errorRecord)
|
||||
{
|
||||
_Context.LogError(errorRecord.Exception.Message);
|
||||
base.Error(errorRecord);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
public override void Warning(string text)
|
||||
{
|
||||
_Context.Invocation.Console.WriteLine(text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="target"></param>
|
||||
/// <param name="action"></param>
|
||||
/// <returns></returns>
|
||||
public override bool ShouldProcess(string target, string action)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="informationRecord"></param>
|
||||
public override void Information(InformationRecord informationRecord)
|
||||
{
|
||||
if (informationRecord?.MessageData is HostInformationMessage info)
|
||||
|
@ -80,6 +112,10 @@ internal sealed class ClientHost : HostContext
|
|||
Console.ForegroundColor = _ForegroundColor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
public override void Verbose(string text)
|
||||
{
|
||||
if (!_Verbose)
|
||||
|
@ -88,6 +124,10 @@ internal sealed class ClientHost : HostContext
|
|||
_Context.LogVerbose(text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
public override void Debug(string text)
|
||||
{
|
||||
if (!_Debug)
|
|
@ -5,19 +5,19 @@ using System.Collections;
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Management.Automation;
|
||||
using Newtonsoft.Json;
|
||||
using PSRule.CommandLine.Resources;
|
||||
using PSRule.Configuration;
|
||||
using PSRule.Data;
|
||||
using PSRule.Pipeline.Dependencies;
|
||||
using PSRule.Tool.Models;
|
||||
using PSRule.Tool.Resources;
|
||||
using PSRule.CommandLine.Models;
|
||||
using SemanticVersion = PSRule.Data.SemanticVersion;
|
||||
|
||||
namespace PSRule.Tool.Commands;
|
||||
namespace PSRule.CommandLine.Commands;
|
||||
|
||||
/// <summary>
|
||||
/// Execute features of the <c>module</c> command through the CLI.
|
||||
/// </summary>
|
||||
internal sealed class ModuleCommand
|
||||
public sealed class ModuleCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Failed to install a module.
|
||||
|
@ -35,6 +35,9 @@ internal sealed class ModuleCommand
|
|||
private const string FIELD_PSDATA = "PSData";
|
||||
private const string PRERELEASE_SEPARATOR = "-";
|
||||
|
||||
/// <summary>
|
||||
/// Call <c>module restore</c>.
|
||||
/// </summary>
|
||||
public static int ModuleRestore(RestoreOptions operationOptions, ClientContext clientContext)
|
||||
{
|
||||
var exitCode = 0;
|
|
@ -1,17 +1,17 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using PSRule.CommandLine.Models;
|
||||
using PSRule.Configuration;
|
||||
using PSRule.Pipeline;
|
||||
using PSRule.Pipeline.Dependencies;
|
||||
using PSRule.Tool.Models;
|
||||
|
||||
namespace PSRule.Tool.Commands;
|
||||
namespace PSRule.CommandLine.Commands;
|
||||
|
||||
/// <summary>
|
||||
/// Execute features of the <c>run</c> command through the CLI.
|
||||
/// </summary>
|
||||
internal sealed class RunCommand
|
||||
public sealed class RunCommand
|
||||
{
|
||||
private const string PUBLISHER = "CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US";
|
||||
|
||||
|
@ -25,12 +25,15 @@ internal sealed class RunCommand
|
|||
/// </summary>
|
||||
private const int ERROR_BREAK_ON_FAILURE = 100;
|
||||
|
||||
/// <summary>
|
||||
/// Call <c>run</c>.
|
||||
/// </summary>
|
||||
public static int Run(RunOptions operationOptions, ClientContext clientContext)
|
||||
{
|
||||
var exitCode = 0;
|
||||
var file = LockFile.Read(null);
|
||||
var inputPath = operationOptions.InputPath == null || operationOptions.InputPath.Length == 0 ?
|
||||
new string[] { Environment.GetWorkingPath() } : operationOptions.InputPath;
|
||||
[Environment.GetWorkingPath()] : operationOptions.InputPath;
|
||||
|
||||
if (operationOptions.Path != null)
|
||||
clientContext.Option.Include.Path = operationOptions.Path;
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace PSRule.CommandLine.Models;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public sealed class ModuleOptions
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string[]? Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string[]? Module { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool Force { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string? Version { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool SkipVerification { get; set; }
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace PSRule.Tool.Models;
|
||||
namespace PSRule.CommandLine.Models;
|
||||
|
||||
/// <summary>
|
||||
/// A record of a module within the lock file.
|
||||
|
@ -10,4 +10,4 @@ namespace PSRule.Tool.Models;
|
|||
/// <param name="Version">The version of the module.</param>
|
||||
/// <param name="Installed">Is the version is installed.</param>
|
||||
/// <param name="Locked">Is the module tracked.</param>
|
||||
internal sealed record ModuleRecord(string Name, string Version, bool Installed, bool Locked);
|
||||
public sealed record ModuleRecord(string Name, string Version, bool Installed, bool Locked);
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace PSRule.CommandLine.Models;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public sealed class RestoreOptions
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string[]? Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool Force { get; set; }
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using PSRule.Rules;
|
||||
|
||||
namespace PSRule.CommandLine.Models;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public sealed class RunOptions
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string[]? Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string[]? Module { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string? Baseline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public RuleOutcome? Outcome { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string[]? InputPath { get; set; }
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\PSRule.Common.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyName>Microsoft.PSRule.CommandLine</AssemblyName>
|
||||
<PackageId>Microsoft.PSRule.CommandLine</PackageId>
|
||||
<RootNamespace>PSRule.CommandLine</RootNamespace>
|
||||
<ProjectGuid>{9a556814-8e9d-4c76-8f6d-1af2da23a9e0}</ProjectGuid>
|
||||
<LangVersion>12.0</LangVersion>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.1" />
|
||||
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ModuleFiles Include="..\PSRule.SDK\PSRule.psd1;" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="CopyModuleFiles" BeforeTargets="Build">
|
||||
<Copy SourceFiles="@(ModuleFiles)" DestinationFolder="$(TargetDir)Modules\PSRule" />
|
||||
</Target>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PSRule.SDK\PSRule.SDK.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Resources\Messages.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Messages.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Resources\Messages.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Messages.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,9 @@
|
|||
# PSRule command-line library for .NET
|
||||
|
||||
This package supports the underlying functionality for running PSRule from the command-line.
|
||||
|
||||
To use PSRule from the command-line, install the `Microsoft.PSRule.Tool` tool package.
|
||||
|
||||
```shell
|
||||
dotnet install tool -g Microsoft.PSRule.Tool
|
||||
```
|
|
@ -8,7 +8,7 @@
|
|||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace PSRule.Tool.Resources {
|
||||
namespace PSRule.CommandLine.Resources {
|
||||
using System;
|
||||
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace PSRule.Tool.Resources {
|
|||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PSRule.Tool.Resources.Messages", typeof(Messages).Assembly);
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PSRule.CommandLine.Resources.Messages", typeof(Messages).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -4,9 +4,10 @@
|
|||
using System.CommandLine;
|
||||
using System.CommandLine.Invocation;
|
||||
using System.Reflection;
|
||||
using PSRule.CommandLine;
|
||||
using PSRule.CommandLine.Commands;
|
||||
using PSRule.CommandLine.Models;
|
||||
using PSRule.Rules;
|
||||
using PSRule.Tool.Commands;
|
||||
using PSRule.Tool.Models;
|
||||
using PSRule.Tool.Resources;
|
||||
|
||||
namespace PSRule.Tool;
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace PSRule.Tool.Models;
|
||||
|
||||
internal sealed class ModuleOptions
|
||||
{
|
||||
public string[]? Path { get; set; }
|
||||
|
||||
public string[]? Module { get; set; }
|
||||
|
||||
public bool Force { get; set; }
|
||||
|
||||
public string? Version { get; set; }
|
||||
|
||||
public bool SkipVerification { get; set; }
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace PSRule.Tool.Models;
|
||||
|
||||
internal sealed class RestoreOptions
|
||||
{
|
||||
public string[]? Path { get; set; }
|
||||
|
||||
public bool Force { get; set; }
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using PSRule.Rules;
|
||||
|
||||
namespace PSRule.Tool.Models;
|
||||
|
||||
internal sealed class RunOptions
|
||||
{
|
||||
public string[]? Path { get; set; }
|
||||
|
||||
public string[]? Module { get; set; }
|
||||
|
||||
public string? Baseline { get; set; }
|
||||
|
||||
public RuleOutcome? Outcome { get; set; }
|
||||
|
||||
public string[]? InputPath { get; set; }
|
||||
}
|
|
@ -19,9 +19,9 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.1" />
|
||||
<!-- <PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.1" />
|
||||
<PackageReference Include="System.Management.Automation" Version="7.4.1" />
|
||||
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
|
||||
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" /> -->
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
@ -38,6 +38,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PSRule.SDK\PSRule.SDK.csproj" />
|
||||
<ProjectReference Include="..\PSRule.CommandLine\PSRule.CommandLine.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -55,19 +56,4 @@
|
|||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Resources\Messages.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Messages.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Resources\Messages.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Messages.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
# PSRule CLI tool
|
||||
|
||||
This package installs the PSRule CLI tool for .NET.
|
||||
To use PSRule from the command-line, install the `Microsoft.PSRule.Tool` tool package.
|
||||
|
||||
```shell
|
||||
dotnet install tool -g Microsoft.PSRule.Tool
|
||||
```
|
||||
|
|
|
@ -8,35 +8,6 @@
|
|||
"resolved": "8.0.0",
|
||||
"contentHash": "DxiTgkCl3CGq1rYmBX2wjY7XGbxiBdL4J+/AJIAFLKy5z70NxhnVRnPghnicXZ8oF6JKVXlW3xwznRbI3ioEKg=="
|
||||
},
|
||||
"Microsoft.PowerShell.SDK": {
|
||||
"type": "Direct",
|
||||
"requested": "[7.4.1, )",
|
||||
"resolved": "7.4.1",
|
||||
"contentHash": "1h0KixYhgGUuRQssGWdqvMCxyHYerw8VPK0XEu2OllUj704yGNTsLb2MjUPV5m35UR/R3JSJL6l9VDx1DdG0fw==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.ObjectPool": "5.0.17",
|
||||
"Microsoft.Management.Infrastructure.CimCmdlets": "7.4.1",
|
||||
"Microsoft.PowerShell.Commands.Diagnostics": "7.4.1",
|
||||
"Microsoft.PowerShell.Commands.Management": "7.4.1",
|
||||
"Microsoft.PowerShell.Commands.Utility": "7.4.1",
|
||||
"Microsoft.PowerShell.ConsoleHost": "7.4.1",
|
||||
"Microsoft.PowerShell.Security": "7.4.1",
|
||||
"Microsoft.WSMan.Management": "7.4.1",
|
||||
"Microsoft.Windows.Compatibility": "8.0.1",
|
||||
"System.Data.SqlClient": "4.8.6",
|
||||
"System.IO.Packaging": "8.0.0",
|
||||
"System.Management.Automation": "7.4.1",
|
||||
"System.Net.Http.WinHttpHandler": "8.0.0",
|
||||
"System.Private.ServiceModel": "4.10.3",
|
||||
"System.ServiceModel.Duplex": "4.10.3",
|
||||
"System.ServiceModel.Http": "4.10.3",
|
||||
"System.ServiceModel.NetTcp": "4.10.3",
|
||||
"System.ServiceModel.Primitives": "4.10.3",
|
||||
"System.ServiceModel.Security": "4.10.3",
|
||||
"System.Text.Encodings.Web": "8.0.0",
|
||||
"System.Web.Services.Description": "4.10.3"
|
||||
}
|
||||
},
|
||||
"Microsoft.SourceLink.GitHub": {
|
||||
"type": "Direct",
|
||||
"requested": "[8.0.0, )",
|
||||
|
@ -47,35 +18,6 @@
|
|||
"Microsoft.SourceLink.Common": "8.0.0"
|
||||
}
|
||||
},
|
||||
"System.CommandLine": {
|
||||
"type": "Direct",
|
||||
"requested": "[2.0.0-beta4.22272.1, )",
|
||||
"resolved": "2.0.0-beta4.22272.1",
|
||||
"contentHash": "1uqED/q2H0kKoLJ4+hI2iPSBSEdTuhfCYADeJrAqERmiGQ2NNacYKRNEQ+gFbU4glgVyK8rxI+ZOe1onEtr/Pg=="
|
||||
},
|
||||
"System.Management.Automation": {
|
||||
"type": "Direct",
|
||||
"requested": "[7.4.1, )",
|
||||
"resolved": "7.4.1",
|
||||
"contentHash": "EYUMyAoYAw4Zt+cxKRMjZxzoa6gI++O4sK+cSg8HUhC1HfrJoMhD1u1Fo5CvlGv1KX3OmoJSyukgkDmRHFLQiw==",
|
||||
"dependencies": {
|
||||
"Microsoft.ApplicationInsights": "2.21.0",
|
||||
"Microsoft.Management.Infrastructure": "3.0.0",
|
||||
"Microsoft.PowerShell.CoreCLR.Eventing": "7.4.1",
|
||||
"Microsoft.PowerShell.Native": "7.4.0",
|
||||
"Microsoft.Security.Extensions": "1.2.0",
|
||||
"Microsoft.Win32.Registry.AccessControl": "8.0.0",
|
||||
"Newtonsoft.Json": "13.0.3",
|
||||
"System.Configuration.ConfigurationManager": "8.0.0",
|
||||
"System.Diagnostics.DiagnosticSource": "8.0.0",
|
||||
"System.DirectoryServices": "8.0.0",
|
||||
"System.Management": "8.0.0",
|
||||
"System.Security.AccessControl": "6.0.0",
|
||||
"System.Security.Cryptography.Pkcs": "8.0.0",
|
||||
"System.Security.Permissions": "8.0.0",
|
||||
"System.Text.Encoding.CodePages": "8.0.0"
|
||||
}
|
||||
},
|
||||
"JetBrains.Annotations": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2021.2.0",
|
||||
|
@ -269,6 +211,34 @@
|
|||
"resolved": "7.4.0",
|
||||
"contentHash": "FlaJ3JBWhqFToYT0ycMb/Xxzoof7oTQbNyI4UikgubC7AMWt5ptBNKjIAMPvOcvEHr+ohaO9GvRWp3tiyS3sKw=="
|
||||
},
|
||||
"Microsoft.PowerShell.SDK": {
|
||||
"type": "Transitive",
|
||||
"resolved": "7.4.1",
|
||||
"contentHash": "1h0KixYhgGUuRQssGWdqvMCxyHYerw8VPK0XEu2OllUj704yGNTsLb2MjUPV5m35UR/R3JSJL6l9VDx1DdG0fw==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.ObjectPool": "5.0.17",
|
||||
"Microsoft.Management.Infrastructure.CimCmdlets": "7.4.1",
|
||||
"Microsoft.PowerShell.Commands.Diagnostics": "7.4.1",
|
||||
"Microsoft.PowerShell.Commands.Management": "7.4.1",
|
||||
"Microsoft.PowerShell.Commands.Utility": "7.4.1",
|
||||
"Microsoft.PowerShell.ConsoleHost": "7.4.1",
|
||||
"Microsoft.PowerShell.Security": "7.4.1",
|
||||
"Microsoft.WSMan.Management": "7.4.1",
|
||||
"Microsoft.Windows.Compatibility": "8.0.1",
|
||||
"System.Data.SqlClient": "4.8.6",
|
||||
"System.IO.Packaging": "8.0.0",
|
||||
"System.Management.Automation": "7.4.1",
|
||||
"System.Net.Http.WinHttpHandler": "8.0.0",
|
||||
"System.Private.ServiceModel": "4.10.3",
|
||||
"System.ServiceModel.Duplex": "4.10.3",
|
||||
"System.ServiceModel.Http": "4.10.3",
|
||||
"System.ServiceModel.NetTcp": "4.10.3",
|
||||
"System.ServiceModel.Primitives": "4.10.3",
|
||||
"System.ServiceModel.Security": "4.10.3",
|
||||
"System.Text.Encodings.Web": "8.0.0",
|
||||
"System.Web.Services.Description": "4.10.3"
|
||||
}
|
||||
},
|
||||
"Microsoft.PowerShell.Security": {
|
||||
"type": "Transitive",
|
||||
"resolved": "7.4.1",
|
||||
|
@ -574,6 +544,11 @@
|
|||
"resolved": "7.0.0",
|
||||
"contentHash": "dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ=="
|
||||
},
|
||||
"System.CommandLine": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.0.0-beta4.22272.1",
|
||||
"contentHash": "1uqED/q2H0kKoLJ4+hI2iPSBSEdTuhfCYADeJrAqERmiGQ2NNacYKRNEQ+gFbU4glgVyK8rxI+ZOe1onEtr/Pg=="
|
||||
},
|
||||
"System.ComponentModel.Annotations": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.4.0",
|
||||
|
@ -802,6 +777,28 @@
|
|||
"System.CodeDom": "8.0.0"
|
||||
}
|
||||
},
|
||||
"System.Management.Automation": {
|
||||
"type": "Transitive",
|
||||
"resolved": "7.4.1",
|
||||
"contentHash": "EYUMyAoYAw4Zt+cxKRMjZxzoa6gI++O4sK+cSg8HUhC1HfrJoMhD1u1Fo5CvlGv1KX3OmoJSyukgkDmRHFLQiw==",
|
||||
"dependencies": {
|
||||
"Microsoft.ApplicationInsights": "2.21.0",
|
||||
"Microsoft.Management.Infrastructure": "3.0.0",
|
||||
"Microsoft.PowerShell.CoreCLR.Eventing": "7.4.1",
|
||||
"Microsoft.PowerShell.Native": "7.4.0",
|
||||
"Microsoft.Security.Extensions": "1.2.0",
|
||||
"Microsoft.Win32.Registry.AccessControl": "8.0.0",
|
||||
"Newtonsoft.Json": "13.0.3",
|
||||
"System.Configuration.ConfigurationManager": "8.0.0",
|
||||
"System.Diagnostics.DiagnosticSource": "8.0.0",
|
||||
"System.DirectoryServices": "8.0.0",
|
||||
"System.Management": "8.0.0",
|
||||
"System.Security.AccessControl": "6.0.0",
|
||||
"System.Security.Cryptography.Pkcs": "8.0.0",
|
||||
"System.Security.Permissions": "8.0.0",
|
||||
"System.Text.Encoding.CodePages": "8.0.0"
|
||||
}
|
||||
},
|
||||
"System.Net.Http": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.3.3",
|
||||
|
@ -1333,6 +1330,14 @@
|
|||
"Newtonsoft.Json": "[13.0.3, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.PSRule.CommandLine": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.PSRule.SDK": "[0.0.1, )",
|
||||
"Microsoft.PowerShell.SDK": "[7.4.1, )",
|
||||
"System.CommandLine": "[2.0.0-beta4.22272.1, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.PSRule.Core": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
|
|
Загрузка…
Ссылка в новой задаче