OpenDsc.Resource.CommandLine
0.5.1
Prefix Reserved
dotnet add package OpenDsc.Resource.CommandLine --version 0.5.1
NuGet\Install-Package OpenDsc.Resource.CommandLine -Version 0.5.1
<PackageReference Include="OpenDsc.Resource.CommandLine" Version="0.5.1" />
<PackageVersion Include="OpenDsc.Resource.CommandLine" Version="0.5.1" />
<PackageReference Include="OpenDsc.Resource.CommandLine" />
paket add OpenDsc.Resource.CommandLine --version 0.5.1
#r "nuget: OpenDsc.Resource.CommandLine, 0.5.1"
#:package OpenDsc.Resource.CommandLine@0.5.1
#addin nuget:?package=OpenDsc.Resource.CommandLine&version=0.5.1
#tool nuget:?package=OpenDsc.Resource.CommandLine&version=0.5.1
OpenDsc.Resource.CommandLine
The OpenDsc.Resource.CommandLine package contains a command-line and
resource manifest generator for Microsoft DSC v3 resources.
Installation
Install the package via NuGet:
dotnet add package OpenDsc.Resource.CommandLine
Usage
This package provides a CommandBuilder class that generates a
System.CommandLine.RootCommand for your DSC resource(s). The command
structure includes:
get: Get the current state of a resource instanceset: Set the desired state of a resource instancetest: Test if a resource instance is in the desired statedelete: Delete a resource instanceexport: Export all instances of a resourceschema: Get the JSON schema for a resourcemanifest: Generate the DSC resource manifest(s)
Single Resource Example
using OpenDsc.Resource.CommandLine;
var resource = new Resource(SourceGenerationContext.Default);
var command = new CommandBuilder()
.AddResource<Resource, Schema>(resource)
.Build();
return command.Parse(args).Invoke();
Multi-Resource Example
Note: Requires DSC v3.2 or later.
You can register multiple resources in a single executable:
using OpenDsc.Resource.CommandLine;
var fileResource = new FileResource(SourceGenerationContext.Default);
var userResource = new UserResource(SourceGenerationContext.Default);
var serviceResource = new ServiceResource(SourceGenerationContext.Default);
var command = new CommandBuilder()
.AddResource<FileResource, FileSchema>(fileResource)
.AddResource<UserResource, UserSchema>(userResource)
.AddResource<ServiceResource, ServiceSchema>(serviceResource)
.Build();
return command.Parse(args).Invoke();
When multiple resources are registered, all commands require the --resource
parameter to specify which resource to operate on.
Commands
get
Retrieves the current state of the resource.
# Single resource
app get --input '{"property": "value"}'
# Multi-resource
app get --resource 'Owner/ResourceName' --input '{"property": "value"}'
set
Sets the desired state of the resource.
# Single resource
app set --input '{"property": "value"}'
# Multi-resource
app set --resource 'Owner/ResourceName' --input '{"property": "value"}'
test
Tests if the resource is in the desired state.
# Single resource
app test --input '{"property": "value"}'
# Multi-resource
app test --resource 'Owner/ResourceName' --input '{"property": "value"}'
delete
Deletes the resource instance.
# Single resource
app delete --input '{"property": "value"}'
# Multi-resource
app delete --resource 'Owner/ResourceName' --input '{"property": "value"}'
export
Exports all instances of the resource.
# Single resource
app export
# Multi-resource
app export --resource 'Owner/ResourceName'
schema
Outputs the JSON schema for the resource.
# Single resource
app schema
# Multi-resource
app schema --resource 'Owner/ResourceName'
manifest
Generates the resource manifest(s).
# Single resource - output to console
app manifest
# Single resource - save to file
app manifest --save
# Multi-resource - all manifests to console
app manifest
# Multi-resource - save all manifests to file
app manifest --save
# Multi-resource - specific resource manifest
app manifest --resource 'Owner/ResourceName'
Requirements
- .NET Standard 2.0 or higher
- Depends on
OpenDsc.ResourceandSystem.CommandLine - DSC v3.2+ required for multi-resource support
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- OpenDsc.Resource (>= 0.5.1)
- System.CommandLine (>= 2.0.0)
-
net10.0
- OpenDsc.Resource (>= 0.5.1)
- System.CommandLine (>= 2.0.0)
-
net8.0
- OpenDsc.Resource (>= 0.5.1)
- System.CommandLine (>= 2.0.0)
-
net9.0
- OpenDsc.Resource (>= 0.5.1)
- System.CommandLine (>= 2.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.