PrettyCommandLine 1.0.0.12

dotnet add package PrettyCommandLine --version 1.0.0.12
NuGet\Install-Package PrettyCommandLine -Version 1.0.0.12
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="PrettyCommandLine" Version="1.0.0.12" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PrettyCommandLine --version 1.0.0.12
#r "nuget: PrettyCommandLine, 1.0.0.12"
#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.
// Install PrettyCommandLine as a Cake Addin
#addin nuget:?package=PrettyCommandLine&version=1.0.0.12

// Install PrettyCommandLine as a Cake Tool
#tool nuget:?package=PrettyCommandLine&version=1.0.0.12

PrettyCommandLine is a versatile console command line handler designed to streamline command-line interactions with ease and clarity. With this NuGet package, users can effortlessly create and manage commands, modes, and subcommands, assigning distinct actions to each.

Key features include:

  1. Flexible Command Structure: Easily add, organize, and customize commands, modes, and subcommands according to your application's requirements.

  2. Validation Support: Seamlessly integrate variable checking and validation methods for precise command execution and error handling.

  3. Multi-Mode Functionality: Enable commands to bind to multiple modes, allowing for dynamic behavior and increased versatility.

  4. Custom Color Schemes: Enhance user experience and visual clarity by assigning unique color schemes to different modes, ensuring clear differentiation and intuitive navigation.

With PrettyCommandLine, developers can create intuitive, user-friendly command-line interfaces for their applications, enhancing usability and efficiency. Whether you're building a simple script or a complex application, PrettyCommandLine empowers you to handle command-line interactions with elegance and precision.

CommandLineBind commandLine = new CommandLineBind();
Modes mode1 = new Modes { Name = "Global", isDefault = true };
Modes mode2 = new Modes { Name = "Config", isDefault = true, Color = ConsoleColor.Gray };
Modes mode3 = new Modes { Name = "Service", isDefault = true, Color = ConsoleColor.White };

commandLine.AddMode(mode1);
commandLine.AddMode(mode2);
commandLine.AddMode(mode3);

Commands Print = new Commands(CommandsBase.CommandTypes.Command) { Command = "Today is" };
Print.AddToMode(mode1);
Print.Executable += delegate { Console.WriteLine("Today Is " + DateTime.Now.DayOfWeek); };

commandLine.AddCommand(Print);

Commands age = new Commands(CommandsBase.CommandTypes.Command) { Command = "my age is" };
age.Variables.Add(new Variable(typeof(int)) { Name = "Age" });
age.Executable += delegate (object sender, CommandExecuteEventArgs e) { Console.WriteLine("Your age is " + e.Variables[0].Value); };

commandLine.AddCommand(age);


Commands test1 = new Commands(CommandsBase.CommandTypes.Command) { Command = "who" };
test1.AddToMode(mode1);
test1.Executable += delegate { Console.WriteLine("Who what?"); };

Commands test11 = new Commands(CommandsBase.CommandTypes.Command) { Command = "am" };
test11.AddToMode(mode1);
test11.Executable += delegate { Console.WriteLine("Who am I?"); };


Commands test12 = new Commands(CommandsBase.CommandTypes.Command) { Command = "i" };
test12.AddToMode(mode1);
test12.Executable += delegate { Console.WriteLine("You are C#"); };

Commands test13 = new Commands(CommandsBase.CommandTypes.Command) { Command = "are" };
test13.AddToMode(mode1);
test13.IsExecutable = true;
test13.Variables.Add(new Variable(typeof(int)) { Name = "Name" , Required = false});
test13.Executable +=
  delegate (object sender, CommandExecuteEventArgs e) {
      if (e.Variables.Count == 0)
          Console.WriteLine("Who are you?");
      else
          Console.WriteLine("Who are these " + e.Variables[0].Value +" Guys?");

  };

Commands test14 = new Commands(CommandsBase.CommandTypes.Command) { Command = "you" };
test14.AddToMode(mode1);
test14.Executable += delegate (object sender, CommandExecuteEventArgs e) { 
  if(e.Variables.Count==0 )
      Console.WriteLine("I'm C#");
 else
      Console.WriteLine("I'm " + e.Variables[0].Value);

};
test14.Variables.Add(new Variable(typeof(string)) { Name = "Name" ,Required = true});


test1.AddSubCommand(test11);
test11.AddSubCommand(test12);

test1.AddSubCommand(test13);
test13.AddSubCommand(test14);

commandLine.AddCommand(test1);

commandLine.Start();
Product 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-android34.0 is compatible.  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. 
.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 net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.5

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net8.0-android34.0

    • 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.

Version Downloads Last updated
1.0.0.12 95 3/28/2024
1.0.0.11 95 3/28/2024
1.0.0.10 97 3/26/2024
1.0.0.8 100 3/25/2024
1.0.0.7 108 3/25/2024
1.0.0.6 117 3/25/2024
1.0.0.5 109 3/25/2024
1.0.0.4 105 3/25/2024
1.0.0.3 97 3/25/2024
1.0.0.2 103 3/25/2024
1.0.0.1 107 3/22/2024
1.0.0 102 3/22/2024