Bucket.CLI
1.0.5
dotnet add package Bucket.CLI --version 1.0.5
NuGet\Install-Package Bucket.CLI -Version 1.0.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bucket.CLI" Version="1.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bucket.CLI" Version="1.0.5" />
<PackageReference Include="Bucket.CLI" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bucket.CLI --version 1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Bucket.CLI, 1.0.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bucket.CLI@1.0.5
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bucket.CLI&version=1.0.5
#tool nuget:?package=Bucket.CLI&version=1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Bucket.CLI
Bucket.CLI is a library that provides a way organize to commands in a CLI application
Installation
Use the dotnet add command to install Bucket.CLI.
dotnet add Bucket.CLI
Usage
Example component
using Bucket.CLI;
namespace Testing.TestObjects
{
public class TestComponent : Component
{
public TestComponent(string name, string description) : base(
name,
description
)
{ }
public TestComponent() : base(
"test",
"function for testing"
)
{ }
public override void Execute(params string[] args)
{
Console.WriteLine($"Executed {Name} function");
}
public override void ValidateArguments(params string[] args)
{
Console.WriteLine($"Validating arguments for {Name} function");
return;
}
}
}
Example usage
class Program
{
static void Main(string[] args)
{
// Create the component that will serve as the root
// by configuring the ValidateArguments method, this component can be set up to perform an action,
// display an error message, or return a list of all components in the CLI application
// we set the ignoreFromTraversal flag to true, meaning we don't have to call it out explicitly
// when passing arguments to the application (false by default)
var root = new TestComponent("root", "this is the root component", true);
// this component provides a parent for all photo-based components
// displays all child components and requests user input on which one to call
var photoComponent = new PhotoComponent();
// this component goes through a photos folder, moving them to specific date-based folders
var photoFileComponent = new PhotoFileComponent();
// organize the components as desired
root.Children.Add(photoComponent);
photoComponent.Children.Add(photoFileComponent);
// generate the execution context, passing the root component
// this will search through the components for the target one to be executed
// as our root component was configured to ignore itself in the command the args would be:
// photo photofile
// HandleCommand will parse the command, determine which component to execute
// call that component's ValidateArguments method, and call that component's Execute method
root.HandleCommand(args)
}
}
Optional arguments
Components will ignore any tokens that begin with two hyphens (--), eventually passing them down to the target component once found
License
| 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 was computed. 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 was computed. 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 was computed. 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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.