mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-07-05 03:58:16 +08:00
Preparations for the 1.0 release
* Less cluttered solution layout. * Move examples to a repository of its own. * Move Roslyn analyzer to a repository of its own. * Enable central package management. * Clean up csproj files. * Add README file to NuGet packages.
This commit is contained in:

committed by
Patrik Svensson

parent
bb72b44d60
commit
42fd801876
18
src/Tests/Spectre.Console.Cli.Tests/Constants.cs
Normal file
18
src/Tests/Spectre.Console.Cli.Tests/Constants.cs
Normal file
@ -0,0 +1,18 @@
|
||||
namespace Spectre.Console.Tests;
|
||||
|
||||
public static class Constants
|
||||
{
|
||||
public static string[] VersionCommand { get; } =
|
||||
new[]
|
||||
{
|
||||
CliConstants.Commands.Branch,
|
||||
CliConstants.Commands.Version,
|
||||
};
|
||||
|
||||
public static string[] XmlDocCommand { get; } =
|
||||
new[]
|
||||
{
|
||||
CliConstants.Commands.Branch,
|
||||
CliConstants.Commands.XmlDoc,
|
||||
};
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
using SystemConsole = System.Console;
|
||||
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public abstract class AnimalCommand<TSettings> : Command<TSettings>
|
||||
where TSettings : CommandSettings
|
||||
{
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class AsynchronousCommand : AsyncCommand<AsynchronousCommandSettings>
|
||||
{
|
||||
private readonly IAnsiConsole _console;
|
||||
|
||||
public AsynchronousCommand(IAnsiConsole console)
|
||||
{
|
||||
_console = console;
|
||||
}
|
||||
|
||||
public async override Task<int> ExecuteAsync(CommandContext context, AsynchronousCommandSettings settings)
|
||||
{
|
||||
// Simulate a long running asynchronous task
|
||||
await Task.Delay(200);
|
||||
|
||||
if (settings.ThrowException)
|
||||
{
|
||||
throw new Exception($"Throwing exception asynchronously");
|
||||
}
|
||||
else
|
||||
{
|
||||
_console.WriteLine($"Finished executing asynchronously");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public class CatCommand : AnimalCommand<CatSettings>
|
||||
{
|
||||
public override int Execute(CommandContext context, CatSettings settings)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
[Description("The dog command.")]
|
||||
public class DogCommand : AnimalCommand<DogSettings>
|
||||
{
|
||||
public override ValidationResult Validate(CommandContext context, DogSettings settings)
|
||||
{
|
||||
if (context is null)
|
||||
{
|
||||
throw new System.ArgumentNullException(nameof(context));
|
||||
}
|
||||
|
||||
if (settings is null)
|
||||
{
|
||||
throw new System.ArgumentNullException(nameof(settings));
|
||||
}
|
||||
|
||||
if (settings.Age > 100 && !context.Remaining.Raw.Contains("zombie"))
|
||||
{
|
||||
return ValidationResult.Error("Dog is too old...");
|
||||
}
|
||||
|
||||
return base.Validate(context, settings);
|
||||
}
|
||||
|
||||
public override int Execute(CommandContext context, DogSettings settings)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class DumpRemainingCommand : Command<EmptyCommandSettings>
|
||||
{
|
||||
private readonly IAnsiConsole _console;
|
||||
|
||||
public DumpRemainingCommand(IAnsiConsole console)
|
||||
{
|
||||
_console = console;
|
||||
}
|
||||
|
||||
public override int Execute(CommandContext context, EmptyCommandSettings settings)
|
||||
{
|
||||
if (context.Remaining.Raw.Count > 0)
|
||||
{
|
||||
_console.WriteLine("# Raw");
|
||||
foreach (var item in context.Remaining.Raw)
|
||||
{
|
||||
_console.WriteLine(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (context.Remaining.Parsed.Count > 0)
|
||||
{
|
||||
_console.WriteLine("# Parsed");
|
||||
foreach (var item in context.Remaining.Parsed)
|
||||
{
|
||||
_console.WriteLine(string.Format("{0}={1}", item.Key, string.Join(",", item.Select(x => x))));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class EmptyCommand : Command<EmptyCommandSettings>
|
||||
{
|
||||
public override int Execute(CommandContext context, EmptyCommandSettings settings)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class GenericCommand<TSettings> : Command<TSettings>
|
||||
where TSettings : CommandSettings
|
||||
{
|
||||
public override int Execute(CommandContext context, TSettings settings)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
[Description("The giraffe command.")]
|
||||
public sealed class GiraffeCommand : Command<GiraffeSettings>
|
||||
{
|
||||
public override int Execute(CommandContext context, GiraffeSettings settings)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using Spectre.Console;
|
||||
|
||||
public class GreeterCommand : Command<OptionalArgumentWithDefaultValueSettings>
|
||||
{
|
||||
private readonly IAnsiConsole _console;
|
||||
|
||||
public GreeterCommand(IAnsiConsole console)
|
||||
{
|
||||
_console = console;
|
||||
}
|
||||
|
||||
public override int Execute(CommandContext context, OptionalArgumentWithDefaultValueSettings settings)
|
||||
{
|
||||
_console.WriteLine(settings.Greeting);
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class HiddenOptionsCommand : Command<HiddenOptionSettings>
|
||||
{
|
||||
public override int Execute(CommandContext context, HiddenOptionSettings settings)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
[Description("The horse command.")]
|
||||
public class HorseCommand : AnimalCommand<HorseSettings>
|
||||
{
|
||||
public override int Execute(CommandContext context, HorseSettings settings)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class InvalidCommand : Command<InvalidSettings>
|
||||
{
|
||||
public override int Execute(CommandContext context, InvalidSettings settings)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
[Description("The lion command.")]
|
||||
public class LionCommand : AnimalCommand<LionSettings>
|
||||
{
|
||||
public override int Execute(CommandContext context, LionSettings settings)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class NoDescriptionCommand : Command<EmptyCommandSettings>
|
||||
{
|
||||
[CommandOption("-f|--foo <VALUE>")]
|
||||
public int Foo { get; set; }
|
||||
|
||||
public override int Execute(CommandContext context, EmptyCommandSettings settings)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public class OptionVectorCommand : Command<OptionVectorSettings>
|
||||
{
|
||||
public override int Execute(CommandContext context, OptionVectorSettings settings)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class ThrowingCommand : Command<ThrowingCommandSettings>
|
||||
{
|
||||
public override int Execute(CommandContext context, ThrowingCommandSettings settings)
|
||||
{
|
||||
throw new InvalidOperationException("W00t?");
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
[Description("The turtle command.")]
|
||||
public class TurtleCommand : AnimalCommand<TurtleSettings>
|
||||
{
|
||||
public override int Execute(CommandContext context, TurtleSettings settings)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class VersionCommand : Command<VersionSettings>
|
||||
{
|
||||
private readonly IAnsiConsole _console;
|
||||
|
||||
public VersionCommand(IAnsiConsole console)
|
||||
{
|
||||
_console = console;
|
||||
}
|
||||
|
||||
public override int Execute(CommandContext context, VersionSettings settings)
|
||||
{
|
||||
_console.WriteLine($"VersionCommand ran, Version: {settings.Version ?? string.Empty}");
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class CatAgilityConverter : TypeConverter
|
||||
{
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||
{
|
||||
if (value is string stringValue)
|
||||
{
|
||||
return stringValue.Length;
|
||||
}
|
||||
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class StringToIntegerConverter : TypeConverter
|
||||
{
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||
{
|
||||
if (value is string stringValue)
|
||||
{
|
||||
return int.Parse(stringValue, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
using Spectre.Console.Rendering;
|
||||
|
||||
namespace Spectre.Console.Cli.Tests.Data.Help;
|
||||
|
||||
internal class CustomHelpProvider : HelpProvider
|
||||
{
|
||||
private readonly string version;
|
||||
|
||||
public CustomHelpProvider(ICommandAppSettings settings, string version)
|
||||
: base(settings)
|
||||
{
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public override IEnumerable<IRenderable> GetHeader(ICommandModel model, ICommandInfo command)
|
||||
{
|
||||
return new IRenderable[]
|
||||
{
|
||||
new Text("--------------------------------------"), Text.NewLine,
|
||||
new Text("--- CUSTOM HELP PROVIDER ---"), Text.NewLine,
|
||||
new Text("--------------------------------------"), Text.NewLine,
|
||||
Text.NewLine,
|
||||
};
|
||||
}
|
||||
|
||||
public override IEnumerable<IRenderable> GetFooter(ICommandModel model, ICommandInfo command)
|
||||
{
|
||||
return new IRenderable[]
|
||||
{
|
||||
Text.NewLine,
|
||||
new Text($"Version {version}"),
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using Spectre.Console.Rendering;
|
||||
|
||||
namespace Spectre.Console.Cli.Tests.Data.Help;
|
||||
|
||||
internal class RedirectHelpProvider : IHelpProvider
|
||||
{
|
||||
public virtual IEnumerable<IRenderable> Write(ICommandModel model)
|
||||
{
|
||||
return Write(model, null);
|
||||
}
|
||||
#nullable enable
|
||||
public virtual IEnumerable<IRenderable> Write(ICommandModel model, ICommandInfo? command)
|
||||
#nullable disable
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
new Text("Help has moved online. Please see: http://www.example.com"),
|
||||
Text.NewLine,
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
namespace Spectre.Console.Cli.Tests.Data.Help;
|
||||
|
||||
internal class RenderMarkupHelpProvider : HelpProvider
|
||||
{
|
||||
protected override bool RenderMarkupInline { get; } = true;
|
||||
|
||||
public RenderMarkupHelpProvider(ICommandAppSettings settings)
|
||||
: base(settings)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public abstract class AnimalSettings : CommandSettings
|
||||
{
|
||||
[CommandOption("-a|--alive|--not-dead")]
|
||||
[Description("Indicates whether or not the animal is alive.")]
|
||||
public bool IsAlive { get; set; }
|
||||
|
||||
[CommandArgument(1, "[LEGS]")]
|
||||
[Description("The number of legs.")]
|
||||
[EvenNumberValidator("Animals must have an even number of legs.")]
|
||||
[PositiveNumberValidator("Number of legs must be greater than 0.")]
|
||||
public int Legs { get; set; }
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class ArgumentOrderSettings : CommandSettings
|
||||
{
|
||||
[CommandArgument(0, "[QUX]")]
|
||||
public int Qux { get; set; }
|
||||
|
||||
[CommandArgument(3, "<CORGI>")]
|
||||
public int Corgi { get; set; }
|
||||
|
||||
[CommandArgument(1, "<BAR>")]
|
||||
public int Bar { get; set; }
|
||||
|
||||
[CommandArgument(2, "<BAZ>")]
|
||||
public int Baz { get; set; }
|
||||
|
||||
[CommandArgument(0, "<FOO>")]
|
||||
public int Foo { get; set; }
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public class ArgumentVectorSettings : CommandSettings
|
||||
{
|
||||
[CommandArgument(0, "<Foos>")]
|
||||
public string[] Foo { get; set; }
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class AsynchronousCommandSettings : CommandSettings
|
||||
{
|
||||
[CommandOption("--ThrowException")]
|
||||
[DefaultValue(false)]
|
||||
public bool ThrowException { get; set; }
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public class BarCommandSettings : FooCommandSettings
|
||||
{
|
||||
[CommandArgument(0, "<CORGI>")]
|
||||
[Description("The corgi value.")]
|
||||
public string Corgi { get; set; }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public class CatSettings : MammalSettings
|
||||
{
|
||||
[CommandOption("--agility <VALUE>")]
|
||||
[TypeConverter(typeof(CatAgilityConverter))]
|
||||
[DefaultValue(10)]
|
||||
[Description("The agility between 0 and 100.")]
|
||||
[PositiveNumberValidator("Agility cannot be negative.")]
|
||||
public int Agility { get; set; }
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class DogSettings : MammalSettings
|
||||
{
|
||||
[CommandArgument(0, "<AGE>")]
|
||||
public int Age { get; set; }
|
||||
|
||||
[CommandOption("-g|--good-boy")]
|
||||
public bool GoodBoy { get; set; }
|
||||
|
||||
public override ValidationResult Validate()
|
||||
{
|
||||
if (Name == "Tiger")
|
||||
{
|
||||
return ValidationResult.Error("Tiger is not a dog name!");
|
||||
}
|
||||
|
||||
return ValidationResult.Success();
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public class FooCommandSettings : CommandSettings
|
||||
{
|
||||
[CommandArgument(0, "[QUX]")]
|
||||
[Description("The qux value.")]
|
||||
public string Qux { get; set; }
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class GiraffeSettings : MammalSettings
|
||||
{
|
||||
[CommandArgument(0, "<LENGTH>")]
|
||||
[Description("The option description.")]
|
||||
public int Length { get; set; }
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class HiddenOptionSettings : CommandSettings
|
||||
{
|
||||
[CommandArgument(0, "<FOO>")]
|
||||
[Description("Dummy argument FOO")]
|
||||
public int Foo { get; set; }
|
||||
|
||||
[CommandOption("--bar", IsHidden = true)]
|
||||
[Description("You should not be able to read this unless you used the 'cli explain' command with the '--hidden' option")]
|
||||
public int Bar { get; set; }
|
||||
|
||||
[CommandOption("--baz")]
|
||||
[Description("Dummy option BAZ")]
|
||||
public int Baz { get; set; }
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public class HorseSettings : MammalSettings
|
||||
{
|
||||
[CommandOption("-d|--day <Mon|Tue>")]
|
||||
public DayOfWeek Day { get; set; }
|
||||
|
||||
[CommandOption("--file")]
|
||||
[DefaultValue("food.txt")]
|
||||
public FileInfo File { get; set; }
|
||||
|
||||
[CommandOption("--directory")]
|
||||
public DirectoryInfo Directory { get; set; }
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class InvalidSettings : CommandSettings
|
||||
{
|
||||
[CommandOption("-f|--foo [BAR]")]
|
||||
public string Value { get; set; }
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public class LionSettings : CatSettings
|
||||
{
|
||||
[CommandArgument(0, "<TEETH>")]
|
||||
[Description("The number of teeth the lion has.")]
|
||||
public int Teeth { get; set; }
|
||||
|
||||
[CommandOption("-c <CHILDREN>")]
|
||||
[Description("The number of children the lion has.")]
|
||||
public int Children { get; set; }
|
||||
|
||||
[CommandOption("-d <DAY>")]
|
||||
[Description("The days the lion goes hunting.")]
|
||||
[DefaultValue(new[] { DayOfWeek.Monday, DayOfWeek.Thursday })]
|
||||
public DayOfWeek[] HuntDays { get; set; }
|
||||
|
||||
[CommandOption("-w|--weight [WEIGHT]")]
|
||||
[Description("The weight of the lion, in kgs.")]
|
||||
public FlagValue<int?> Weight { get; set; }
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public class MammalSettings : AnimalSettings
|
||||
{
|
||||
[CommandOption("-n|-p|--name|--pet-name <VALUE>")]
|
||||
public string Name { get; set; }
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public class MultipleArgumentVectorSettings : CommandSettings
|
||||
{
|
||||
[CommandArgument(0, "<Foos>")]
|
||||
public string[] Foo { get; set; }
|
||||
|
||||
[CommandArgument(0, "<Bars>")]
|
||||
public string[] Bar { get; set; }
|
||||
}
|
||||
|
||||
public class MultipleArgumentVectorSpecifiedFirstSettings : CommandSettings
|
||||
{
|
||||
[CommandArgument(1, "[Bar]")]
|
||||
public string Bar { get; set; }
|
||||
|
||||
[CommandArgument(0, "<Foos>")]
|
||||
public string[] Foo { get; set; }
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public class OptionVectorSettings : CommandSettings
|
||||
{
|
||||
[CommandOption("--foo")]
|
||||
public string[] Foo { get; set; }
|
||||
|
||||
[CommandOption("--bar")]
|
||||
public int[] Bar { get; set; }
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class OptionalArgumentWithDefaultValueSettings : CommandSettings
|
||||
{
|
||||
[CommandArgument(0, "[GREETING]")]
|
||||
[DefaultValue("Hello World")]
|
||||
public string Greeting { get; set; }
|
||||
}
|
||||
|
||||
public sealed class OptionalArgumentWithPropertyInitializerSettings : CommandSettings
|
||||
{
|
||||
[CommandArgument(0, "[NAMES]")]
|
||||
public string[] Names { get; set; } = Array.Empty<string>();
|
||||
|
||||
[CommandOption("-c")]
|
||||
public int Count { get; set; } = 1;
|
||||
|
||||
[CommandOption("--value")]
|
||||
public int Value { get; set; } = 0;
|
||||
}
|
||||
|
||||
public sealed class OptionalArgumentWithDefaultValueAndTypeConverterSettings : CommandSettings
|
||||
{
|
||||
[CommandArgument(0, "[GREETING]")]
|
||||
[DefaultValue("5")]
|
||||
[TypeConverter(typeof(StringToIntegerConverter))]
|
||||
public int Greeting { get; set; }
|
||||
}
|
||||
|
||||
public sealed class RequiredArgumentWithDefaultValueSettings : CommandSettings
|
||||
{
|
||||
[CommandArgument(0, "<GREETING>")]
|
||||
[DefaultValue("Hello World")]
|
||||
public string Greeting { get; set; }
|
||||
}
|
||||
|
||||
public sealed class OptionWithArrayOfEnumDefaultValueSettings : CommandSettings
|
||||
{
|
||||
[CommandOption("--days")]
|
||||
[DefaultValue(new[] { DayOfWeek.Sunday, DayOfWeek.Saturday })]
|
||||
public DayOfWeek[] Days { get; set; }
|
||||
}
|
||||
|
||||
public sealed class OptionWithArrayOfStringDefaultValueAndTypeConverterSettings : CommandSettings
|
||||
{
|
||||
[CommandOption("--numbers")]
|
||||
[DefaultValue(new[] { "2", "3" })]
|
||||
[TypeConverter(typeof(StringToIntegerConverter))]
|
||||
public int[] Numbers { get; set; }
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public class ReptileSettings : AnimalSettings
|
||||
{
|
||||
[CommandOption("-n|-p|--name|--pet-name <VALUE>")]
|
||||
public string Name { get; set; }
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class StringOptionSettings : CommandSettings
|
||||
{
|
||||
[CommandOption("-f|--foo")]
|
||||
public string Foo { get; set; }
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class ThrowingCommandSettings : CommandSettings
|
||||
{
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class TurtleSettings : ReptileSettings
|
||||
{
|
||||
public TurtleSettings(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public override ValidationResult Validate()
|
||||
{
|
||||
return Name != "Lonely George"
|
||||
? ValidationResult.Error("Only 'Lonely George' is valid name for a turtle!")
|
||||
: ValidationResult.Success();
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class VersionSettings : CommandSettings
|
||||
{
|
||||
[CommandOption("-v|--version")]
|
||||
public string Version { get; set; }
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
|
||||
public sealed class EvenNumberValidatorAttribute : ParameterValidationAttribute
|
||||
{
|
||||
public EvenNumberValidatorAttribute(string errorMessage)
|
||||
: base(errorMessage)
|
||||
{
|
||||
}
|
||||
|
||||
public override ValidationResult Validate(CommandParameterContext context)
|
||||
{
|
||||
if (context.Value is int integer)
|
||||
{
|
||||
if (integer % 2 == 0)
|
||||
{
|
||||
return ValidationResult.Success();
|
||||
}
|
||||
|
||||
return ValidationResult.Error($"Number is not even ({context.Parameter.PropertyName}).");
|
||||
}
|
||||
|
||||
throw new InvalidOperationException($"Parameter is not a number ({context.Parameter.PropertyName}).");
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
|
||||
public sealed class PositiveNumberValidatorAttribute : ParameterValidationAttribute
|
||||
{
|
||||
public PositiveNumberValidatorAttribute(string errorMessage)
|
||||
: base(errorMessage)
|
||||
{
|
||||
}
|
||||
|
||||
public override ValidationResult Validate(CommandParameterContext context)
|
||||
{
|
||||
if (context.Value is int integer)
|
||||
{
|
||||
if (integer > 0)
|
||||
{
|
||||
return ValidationResult.Success();
|
||||
}
|
||||
|
||||
return ValidationResult.Error($"Number is not greater than 0 ({context.Parameter.PropertyName}).");
|
||||
}
|
||||
|
||||
throw new InvalidOperationException($"Parameter is not a number ({context.Parameter.PropertyName}).");
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
Error: An error occured when parsing template.
|
||||
Arguments can not contain options.
|
||||
|
||||
--foo <BAR>
|
||||
^^^^^ Not permitted
|
@ -0,0 +1,5 @@
|
||||
Error: An error occured when parsing template.
|
||||
Encountered invalid character '$' in option name.
|
||||
|
||||
--f$oo
|
||||
^ Invalid character
|
@ -0,0 +1,5 @@
|
||||
Error: An error occured when parsing template.
|
||||
Encountered invalid character '$' in value name.
|
||||
|
||||
-f|--foo <F$OO>
|
||||
^ Invalid character
|
@ -0,0 +1,5 @@
|
||||
Error: An error occured when parsing template.
|
||||
Long option names must consist of more than one character.
|
||||
|
||||
--f
|
||||
^ Invalid option name
|
@ -0,0 +1,5 @@
|
||||
Error: An error occured when parsing template.
|
||||
No long or short name for option has been specified.
|
||||
|
||||
<FOO>
|
||||
^^^^^ Missing option. Was this meant to be an argument?
|
@ -0,0 +1,5 @@
|
||||
Error: An error occured when parsing template.
|
||||
Multiple option values are not supported.
|
||||
|
||||
-f|--foo <FOO> <BAR>
|
||||
^^^^^ Too many option values
|
@ -0,0 +1,5 @@
|
||||
Error: An error occured when parsing template.
|
||||
Multiple values are not supported.
|
||||
|
||||
<FOO> <BAR>
|
||||
^^^^^ Too many values
|
@ -0,0 +1,5 @@
|
||||
Error: An error occured when parsing template.
|
||||
Option names cannot start with a digit.
|
||||
|
||||
--1foo
|
||||
^^^^ Invalid option name
|
@ -0,0 +1,5 @@
|
||||
Error: An error occured when parsing template.
|
||||
Options without name are not allowed.
|
||||
|
||||
--foo|-
|
||||
^ Missing option name
|
@ -0,0 +1,5 @@
|
||||
Error: An error occured when parsing template.
|
||||
Short option names can not be longer than one character.
|
||||
|
||||
--foo|-bar
|
||||
^^^ Invalid option name
|
@ -0,0 +1,5 @@
|
||||
Error: An error occured when parsing template.
|
||||
Encountered unexpected character '$'.
|
||||
|
||||
<FOO> $ <BAR>
|
||||
^ Unexpected character
|
@ -0,0 +1,5 @@
|
||||
Error: An error occured when parsing template.
|
||||
Encountered unterminated value name 'BAR'.
|
||||
|
||||
--foo|-f <BAR
|
||||
^^^^ Unterminated value name
|
@ -0,0 +1,5 @@
|
||||
Error: An error occured when parsing template.
|
||||
Values without name are not allowed.
|
||||
|
||||
<>
|
||||
^^ Missing value name
|
@ -0,0 +1,12 @@
|
||||
USAGE:
|
||||
myapp <FOO> <BAR> <BAZ> <CORGI> [QUX] [OPTIONS]
|
||||
|
||||
ARGUMENTS:
|
||||
<FOO>
|
||||
<BAR>
|
||||
<BAZ>
|
||||
<CORGI>
|
||||
[QUX]
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
@ -0,0 +1,18 @@
|
||||
DESCRIPTION:
|
||||
Contains settings for a cat.
|
||||
|
||||
USAGE:
|
||||
myapp cat [LEGS] [OPTIONS] <COMMAND>
|
||||
|
||||
ARGUMENTS:
|
||||
[LEGS] The number of legs
|
||||
|
||||
OPTIONS:
|
||||
DEFAULT
|
||||
-h, --help Prints help information
|
||||
-a, --alive Indicates whether or not the animal is alive
|
||||
-n, --name <VALUE>
|
||||
--agility <VALUE> 10 The agility between 0 and 100
|
||||
|
||||
COMMANDS:
|
||||
lion <TEETH> The lion command
|
@ -0,0 +1,18 @@
|
||||
DESCRIPTION:
|
||||
Contains settings for a cat.
|
||||
|
||||
USAGE:
|
||||
myapp cat [LEGS] [OPTIONS] <COMMAND>
|
||||
|
||||
ARGUMENTS:
|
||||
[LEGS] The number of legs
|
||||
|
||||
OPTIONS:
|
||||
DEFAULT
|
||||
-h, --help Prints help information
|
||||
-a, --alive Indicates whether or not the animal is alive
|
||||
-n, --name <VALUE>
|
||||
--agility <VALUE> 10 The agility between 0 and 100
|
||||
|
||||
COMMANDS:
|
||||
lion <TEETH> The lion command
|
@ -0,0 +1,11 @@
|
||||
USAGE:
|
||||
myapp branch [GREETING] [OPTIONS] [COMMAND]
|
||||
|
||||
ARGUMENTS:
|
||||
[GREETING]
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
|
||||
COMMANDS:
|
||||
greeter
|
@ -0,0 +1,30 @@
|
||||
DESCRIPTION:
|
||||
The animal command.
|
||||
|
||||
USAGE:
|
||||
myapp animal [LEGS] [OPTIONS] <COMMAND>
|
||||
|
||||
EXAMPLES:
|
||||
myapp animal dog --name Rufus --age 12 --good-boy
|
||||
myapp animal dog --name Luna
|
||||
myapp animal dog --name Charlie
|
||||
myapp animal dog --name Bella
|
||||
myapp animal dog --name Daisy
|
||||
myapp animal dog --name Milo
|
||||
myapp animal horse --name Brutus
|
||||
myapp animal horse --name Sugar --IsAlive false
|
||||
myapp animal horse --name Cash
|
||||
myapp animal horse --name Dakota
|
||||
myapp animal horse --name Cisco
|
||||
myapp animal horse --name Spirit
|
||||
|
||||
ARGUMENTS:
|
||||
[LEGS] The number of legs
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
-a, --alive Indicates whether or not the animal is alive
|
||||
|
||||
COMMANDS:
|
||||
dog <AGE> The dog command
|
||||
horse The horse command
|
@ -0,0 +1,17 @@
|
||||
DESCRIPTION:
|
||||
Contains settings for a cat.
|
||||
|
||||
USAGE:
|
||||
myapp cat [LEGS] [OPTIONS] <COMMAND>
|
||||
|
||||
ARGUMENTS:
|
||||
[LEGS] The number of legs
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
-a, --alive Indicates whether or not the animal is alive
|
||||
-n, --name <VALUE>
|
||||
--agility <VALUE> The agility between 0 and 100
|
||||
|
||||
COMMANDS:
|
||||
lion <TEETH> The lion command
|
@ -0,0 +1,14 @@
|
||||
--------------------------------------
|
||||
--- CUSTOM HELP PROVIDER ---
|
||||
--------------------------------------
|
||||
|
||||
USAGE:
|
||||
myapp [OPTIONS] <COMMAND>
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
|
||||
COMMANDS:
|
||||
dog <AGE> The dog command
|
||||
|
||||
Version 1.0
|
@ -0,0 +1 @@
|
||||
Help has moved online. Please see: http://www.example.com
|
@ -0,0 +1,14 @@
|
||||
--------------------------------------
|
||||
--- CUSTOM HELP PROVIDER ---
|
||||
--------------------------------------
|
||||
|
||||
USAGE:
|
||||
myapp [OPTIONS] <COMMAND>
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
|
||||
COMMANDS:
|
||||
dog <AGE> The dog command
|
||||
|
||||
Version 1.0
|
@ -0,0 +1 @@
|
||||
Help has moved online. Please see: http://www.example.com
|
@ -0,0 +1,19 @@
|
||||
DESCRIPTION:
|
||||
The lion command.
|
||||
|
||||
USAGE:
|
||||
myapp <TEETH> [LEGS] [OPTIONS]
|
||||
|
||||
ARGUMENTS:
|
||||
<TEETH> The number of teeth the lion has
|
||||
[LEGS] The number of legs
|
||||
|
||||
OPTIONS:
|
||||
DEFAULT
|
||||
-h, --help Prints help information
|
||||
-a, --alive Indicates whether or not the animal is alive
|
||||
-n, --name <VALUE>
|
||||
--agility <VALUE> 10 The agility between 0 and 100
|
||||
-c <CHILDREN> The number of children the lion has
|
||||
-d <DAY> Monday, Thursday The days the lion goes hunting
|
||||
-w, --weight [WEIGHT] The weight of the lion, in kgs
|
@ -0,0 +1,15 @@
|
||||
--------------------------------------
|
||||
--- CUSTOM HELP PROVIDER ---
|
||||
--------------------------------------
|
||||
|
||||
USAGE:
|
||||
myapp [OPTIONS] <COMMAND>
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
-v, --version Prints version information
|
||||
|
||||
COMMANDS:
|
||||
dog <AGE> The dog command
|
||||
|
||||
Version 1.0
|
@ -0,0 +1,23 @@
|
||||
DESCRIPTION:
|
||||
The dog command.
|
||||
|
||||
USAGE:
|
||||
myapp <AGE> [LEGS] [OPTIONS]
|
||||
|
||||
EXAMPLES:
|
||||
myapp --name Rufus --age 12 --good-boy
|
||||
myapp --name Luna
|
||||
myapp --name Charlie
|
||||
myapp --name Bella
|
||||
myapp --name Daisy
|
||||
myapp --name Milo
|
||||
|
||||
ARGUMENTS:
|
||||
<AGE>
|
||||
[LEGS] The number of legs
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
-a, --alive Indicates whether or not the animal is alive
|
||||
-n, --name <VALUE>
|
||||
-g, --good-boy
|
@ -0,0 +1 @@
|
||||
Hello World
|
@ -0,0 +1,19 @@
|
||||
DESCRIPTION:
|
||||
The lion command.
|
||||
|
||||
USAGE:
|
||||
myapp <TEETH> [LEGS] [OPTIONS]
|
||||
|
||||
ARGUMENTS:
|
||||
<TEETH> The number of teeth the lion has
|
||||
[LEGS] The number of legs
|
||||
|
||||
OPTIONS:
|
||||
DEFAULT
|
||||
-h, --help Prints help information
|
||||
-a, --alive Indicates whether or not the animal is alive
|
||||
-n, --name <VALUE>
|
||||
--agility <VALUE> 10 The agility between 0 and 100
|
||||
-c <CHILDREN> The number of children the lion has
|
||||
-d <DAY> Monday, Thursday The days the lion goes hunting
|
||||
-w, --weight [WEIGHT] The weight of the lion, in kgs
|
@ -0,0 +1,25 @@
|
||||
BESCHREIBUNG:
|
||||
The lion command.
|
||||
|
||||
VERWENDUNG:
|
||||
myapp <TEETH> [LEGS] [OPTIONEN] [KOMMANDO]
|
||||
|
||||
BEISPIELE:
|
||||
myapp 20 --alive
|
||||
|
||||
ARGUMENTE:
|
||||
<TEETH> The number of teeth the lion has
|
||||
[LEGS] The number of legs
|
||||
|
||||
OPTIONEN:
|
||||
STANDARDWERT
|
||||
-h, --help Zeigt Hilfe an
|
||||
-a, --alive Indicates whether or not the animal is alive
|
||||
-n, --name <VALUE>
|
||||
--agility <VALUE> 10 The agility between 0 and 100
|
||||
-c <CHILDREN> The number of children the lion has
|
||||
-d <DAY> Monday, Thursday The days the lion goes hunting
|
||||
-w, --weight [WEIGHT] The weight of the lion, in kgs
|
||||
|
||||
KOMMANDOS:
|
||||
giraffe <LENGTH> The giraffe command
|
@ -0,0 +1,25 @@
|
||||
DESCRIPTION:
|
||||
The lion command.
|
||||
|
||||
USAGE:
|
||||
myapp <TEETH> [LEGS] [OPTIONS] [COMMAND]
|
||||
|
||||
EXAMPLES:
|
||||
myapp 20 --alive
|
||||
|
||||
ARGUMENTS:
|
||||
<TEETH> The number of teeth the lion has
|
||||
[LEGS] The number of legs
|
||||
|
||||
OPTIONS:
|
||||
DEFAULT
|
||||
-h, --help Prints help information
|
||||
-a, --alive Indicates whether or not the animal is alive
|
||||
-n, --name <VALUE>
|
||||
--agility <VALUE> 10 The agility between 0 and 100
|
||||
-c <CHILDREN> The number of children the lion has
|
||||
-d <DAY> Monday, Thursday The days the lion goes hunting
|
||||
-w, --weight [WEIGHT] The weight of the lion, in kgs
|
||||
|
||||
COMMANDS:
|
||||
giraffe <LENGTH> The giraffe command
|
@ -0,0 +1,25 @@
|
||||
DESCRIPTION:
|
||||
The lion command.
|
||||
|
||||
UTILISATION:
|
||||
myapp <TEETH> [LEGS] [OPTIONS] [COMMANDE]
|
||||
|
||||
EXEMPLES:
|
||||
myapp 20 --alive
|
||||
|
||||
ARGUMENTS:
|
||||
<TEETH> The number of teeth the lion has
|
||||
[LEGS] The number of legs
|
||||
|
||||
OPTIONS:
|
||||
DÉFAUT
|
||||
-h, --help Affiche l'aide
|
||||
-a, --alive Indicates whether or not the animal is alive
|
||||
-n, --name <VALUE>
|
||||
--agility <VALUE> 10 The agility between 0 and 100
|
||||
-c <CHILDREN> The number of children the lion has
|
||||
-d <DAY> Monday, Thursday The days the lion goes hunting
|
||||
-w, --weight [WEIGHT] The weight of the lion, in kgs
|
||||
|
||||
COMMANDES:
|
||||
giraffe <LENGTH> The giraffe command
|
@ -0,0 +1,25 @@
|
||||
BESKRIVNING:
|
||||
The lion command.
|
||||
|
||||
ANVÄNDING:
|
||||
myapp <TEETH> [LEGS] [VAL] [KOMMANDO]
|
||||
|
||||
EXEMPEL:
|
||||
myapp 20 --alive
|
||||
|
||||
ARGUMENT:
|
||||
<TEETH> The number of teeth the lion has
|
||||
[LEGS] The number of legs
|
||||
|
||||
VAL:
|
||||
STANDARD
|
||||
-h, --help Skriver ut hjälpinformation
|
||||
-a, --alive Indicates whether or not the animal is alive
|
||||
-n, --name <VALUE>
|
||||
--agility <VALUE> 10 The agility between 0 and 100
|
||||
-c <CHILDREN> The number of children the lion has
|
||||
-d <DAY> Monday, Thursday The days the lion goes hunting
|
||||
-w, --weight [WEIGHT] The weight of the lion, in kgs
|
||||
|
||||
KOMMANDON:
|
||||
giraffe <LENGTH> The giraffe command
|
@ -0,0 +1,25 @@
|
||||
[bold]DESCRIPTION:[/]
|
||||
The lion command.
|
||||
|
||||
[bold]USAGE:[/]
|
||||
myapp []<TEETH>[/] [][[LEGS]][/] [][[OPTIONS]][/] [][[COMMAND]][/]
|
||||
|
||||
[bold]EXAMPLES:[/]
|
||||
myapp []20 --alive[/]
|
||||
|
||||
[bold]ARGUMENTS:[/]
|
||||
[]<TEETH>[/] The number of teeth the lion has
|
||||
[][[LEGS]][/] The number of legs
|
||||
|
||||
[]OPTIONS:[/]
|
||||
[]DEFAULT[/]
|
||||
-h, --help Prints help information
|
||||
-a, --alive Indicates whether or not the animal is alive
|
||||
-n, --name []<VALUE>[/]
|
||||
--agility []<VALUE>[/] []10[/] The agility between 0 and 100
|
||||
-c []<CHILDREN>[/] The number of children the lion has
|
||||
-d []<DAY>[/] []Monday[/], []Thursday[/] The days the lion goes hunting
|
||||
-w, --weight [][[WEIGHT]][/] The weight of the lion, in kgs
|
||||
|
||||
[bold]COMMANDS:[/]
|
||||
[]giraffe[/] []<LENGTH>[/] The giraffe command
|
@ -0,0 +1,25 @@
|
||||
[yellow]DESCRIPTION:[/]
|
||||
The lion command.
|
||||
|
||||
[yellow]USAGE:[/]
|
||||
myapp [aqua]<TEETH>[/] [silver][[LEGS]][/] [grey][[OPTIONS]][/] [aqua][[COMMAND]][/]
|
||||
|
||||
[yellow]EXAMPLES:[/]
|
||||
myapp [grey]20 --alive[/]
|
||||
|
||||
[yellow]ARGUMENTS:[/]
|
||||
[silver]<TEETH>[/] The number of teeth the lion has
|
||||
[silver][[LEGS]][/] The number of legs
|
||||
|
||||
[yellow]OPTIONS:[/]
|
||||
[lime]DEFAULT[/]
|
||||
-h, --help Prints help information
|
||||
-a, --alive Indicates whether or not the animal is alive
|
||||
-n, --name [silver]<VALUE>[/]
|
||||
--agility [silver]<VALUE>[/] [bold]10[/] The agility between 0 and 100
|
||||
-c [silver]<CHILDREN>[/] The number of children the lion has
|
||||
-d [silver]<DAY>[/] [bold]Monday[/], [bold]Thursday[/] The days the lion goes hunting
|
||||
-w, --weight [grey][[WEIGHT]][/] The weight of the lion, in kgs
|
||||
|
||||
[yellow]COMMANDS:[/]
|
||||
[silver]giraffe[/] [silver]<LENGTH>[/] The giraffe command
|
@ -0,0 +1,25 @@
|
||||
[]DESCRIPTION:[/]
|
||||
The lion command.
|
||||
|
||||
[]USAGE:[/]
|
||||
myapp []<TEETH>[/] [][[LEGS]][/] [][[OPTIONS]][/] [][[COMMAND]][/]
|
||||
|
||||
[]EXAMPLES:[/]
|
||||
myapp []20 --alive[/]
|
||||
|
||||
[]ARGUMENTS:[/]
|
||||
[]<TEETH>[/] The number of teeth the lion has
|
||||
[][[LEGS]][/] The number of legs
|
||||
|
||||
[]OPTIONS:[/]
|
||||
[]DEFAULT[/]
|
||||
-h, --help Prints help information
|
||||
-a, --alive Indicates whether or not the animal is alive
|
||||
-n, --name []<VALUE>[/]
|
||||
--agility []<VALUE>[/] []10[/] The agility between 0 and 100
|
||||
-c []<CHILDREN>[/] The number of children the lion has
|
||||
-d []<DAY>[/] []Monday[/], []Thursday[/] The days the lion goes hunting
|
||||
-w, --weight [][[WEIGHT]][/] The weight of the lion, in kgs
|
||||
|
||||
[]COMMANDS:[/]
|
||||
[]giraffe[/] []<LENGTH>[/] The giraffe command
|
@ -0,0 +1,9 @@
|
||||
USAGE:
|
||||
myapp [OPTIONS] <COMMAND>
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
|
||||
COMMANDS:
|
||||
dog <AGE> The dog command.
|
||||
horse The horse command.
|
@ -0,0 +1,9 @@
|
||||
USAGE:
|
||||
myapp <FOO> [OPTIONS]
|
||||
|
||||
ARGUMENTS:
|
||||
<FOO> Dummy argument FOO
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
--baz Dummy option BAZ
|
@ -0,0 +1,9 @@
|
||||
USAGE:
|
||||
myapp [OPTIONS] <COMMAND>
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
|
||||
COMMANDS:
|
||||
dog <AGE> The dog command
|
||||
horse The horse command
|
@ -0,0 +1,15 @@
|
||||
DESCRIPTION:
|
||||
The lion command.
|
||||
|
||||
USAGE:
|
||||
myapp cat [LEGS] lion <TEETH> [OPTIONS]
|
||||
|
||||
ARGUMENTS:
|
||||
<TEETH> The number of teeth the lion has
|
||||
|
||||
OPTIONS:
|
||||
DEFAULT
|
||||
-h, --help Prints help information
|
||||
-c <CHILDREN> The number of children the lion has
|
||||
-d <DAY> Monday, Thursday The days the lion goes hunting
|
||||
-w, --weight [WEIGHT] The weight of the lion, in kgs
|
@ -0,0 +1,8 @@
|
||||
USAGE:
|
||||
myapp [OPTIONS] <COMMAND>
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
|
||||
COMMANDS:
|
||||
bar
|
@ -0,0 +1,12 @@
|
||||
USAGE:
|
||||
myapp <FOO> <BAR> <BAZ> <CORGI> [QUX] [OPTIONS]
|
||||
|
||||
ARGUMENTS:
|
||||
<FOO>
|
||||
<BAR>
|
||||
<BAZ>
|
||||
<CORGI>
|
||||
[QUX]
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
@ -0,0 +1,10 @@
|
||||
USAGE:
|
||||
myapp [OPTIONS] <COMMAND>
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
|
||||
COMMANDS:
|
||||
dog <AGE> The dog command
|
||||
horse The horse command
|
||||
giraffe <LENGTH> The giraffe command
|
@ -0,0 +1,10 @@
|
||||
USAGE:
|
||||
myapp [OPTIONS] <COMMAND>
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
|
||||
COMMANDS:
|
||||
dog <AGE> The dog command
|
||||
horse The horse command
|
||||
giraffe <LENGTH> The giraffe command
|
@ -0,0 +1,17 @@
|
||||
DESCRIPTION:
|
||||
The horse command.
|
||||
|
||||
USAGE:
|
||||
myapp horse [LEGS] [OPTIONS]
|
||||
|
||||
ARGUMENTS:
|
||||
[LEGS] The number of legs
|
||||
|
||||
OPTIONS:
|
||||
DEFAULT
|
||||
-h, --help Prints help information
|
||||
-a, --alive Indicates whether or not the animal is alive
|
||||
-n, --name <VALUE>
|
||||
-d, --day <MON|TUE>
|
||||
--file food.txt
|
||||
--directory
|
@ -0,0 +1,17 @@
|
||||
DESCRIPTION:
|
||||
The horse command.
|
||||
|
||||
USAGE:
|
||||
myapp horse [LEGS] [OPTIONS]
|
||||
|
||||
ARGUMENTS:
|
||||
[LEGS] The number of legs
|
||||
|
||||
OPTIONS:
|
||||
DEFAULT
|
||||
-h, --help Prints help information
|
||||
-a, --alive Indicates whether or not the animal is alive
|
||||
-n, --name <VALUE>
|
||||
-d, --day <MON|TUE>
|
||||
--file food.txt
|
||||
--directory
|
@ -0,0 +1,23 @@
|
||||
USAGE:
|
||||
myapp [OPTIONS] <COMMAND>
|
||||
|
||||
EXAMPLES:
|
||||
myapp dog --name Rufus --age 12 --good-boy
|
||||
myapp dog --name Luna
|
||||
myapp dog --name Charlie
|
||||
myapp dog --name Bella
|
||||
myapp dog --name Daisy
|
||||
myapp dog --name Milo
|
||||
myapp horse --name Brutus
|
||||
myapp horse --name Sugar --IsAlive false
|
||||
myapp horse --name Cash
|
||||
myapp horse --name Dakota
|
||||
myapp horse --name Cisco
|
||||
myapp horse --name Spirit
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
|
||||
COMMANDS:
|
||||
dog <AGE> The dog command
|
||||
horse The horse command
|
@ -0,0 +1,16 @@
|
||||
USAGE:
|
||||
myapp [OPTIONS] <COMMAND>
|
||||
|
||||
EXAMPLES:
|
||||
myapp dog --name Rufus --age 12 --good-boy
|
||||
myapp dog --name Luna
|
||||
myapp dog --name Charlie
|
||||
myapp dog --name Bella
|
||||
myapp dog --name Daisy
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
|
||||
COMMANDS:
|
||||
dog <AGE> The dog command
|
||||
horse The horse command
|
@ -0,0 +1,19 @@
|
||||
USAGE:
|
||||
myapp [OPTIONS] <COMMAND>
|
||||
|
||||
EXAMPLES:
|
||||
myapp dog --name Rufus --age 12 --good-boy
|
||||
myapp dog --name Luna
|
||||
myapp dog --name Charlie
|
||||
myapp dog --name Bella
|
||||
myapp dog --name Daisy
|
||||
myapp dog --name Milo
|
||||
myapp horse --name Brutus
|
||||
myapp horse --name Sugar --IsAlive false
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
|
||||
COMMANDS:
|
||||
dog <AGE> The dog command
|
||||
horse The horse command
|
@ -0,0 +1,9 @@
|
||||
USAGE:
|
||||
myapp [OPTIONS] <COMMAND>
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
|
||||
COMMANDS:
|
||||
dog <AGE> The dog command
|
||||
horse The horse command
|
@ -0,0 +1,23 @@
|
||||
USAGE:
|
||||
myapp [OPTIONS] <COMMAND>
|
||||
|
||||
EXAMPLES:
|
||||
myapp dog --name Rufus --age 12 --good-boy
|
||||
myapp dog --name Luna
|
||||
myapp dog --name Charlie
|
||||
myapp dog --name Bella
|
||||
myapp dog --name Daisy
|
||||
myapp dog --name Milo
|
||||
myapp horse --name Brutus
|
||||
myapp horse --name Sugar --IsAlive false
|
||||
myapp horse --name Cash
|
||||
myapp horse --name Dakota
|
||||
myapp horse --name Cisco
|
||||
myapp horse --name Spirit
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
|
||||
COMMANDS:
|
||||
dog <AGE> The dog command
|
||||
horse The horse command
|
@ -0,0 +1,15 @@
|
||||
USAGE:
|
||||
myapp [OPTIONS] <COMMAND>
|
||||
|
||||
EXAMPLES:
|
||||
myapp animal dog --name Rufus --age 12 --good-boy
|
||||
myapp animal dog --name Luna
|
||||
myapp animal dog --name Charlie
|
||||
myapp animal dog --name Bella
|
||||
myapp animal dog --name Daisy
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
|
||||
COMMANDS:
|
||||
animal The animal command
|
@ -0,0 +1,18 @@
|
||||
USAGE:
|
||||
myapp [OPTIONS] <COMMAND>
|
||||
|
||||
EXAMPLES:
|
||||
myapp animal dog --name Rufus --age 12 --good-boy
|
||||
myapp animal dog --name Luna
|
||||
myapp animal dog --name Charlie
|
||||
myapp animal dog --name Bella
|
||||
myapp animal dog --name Daisy
|
||||
myapp animal dog --name Milo
|
||||
myapp animal horse --name Brutus
|
||||
myapp animal horse --name Sugar --IsAlive false
|
||||
|
||||
OPTIONS:
|
||||
-h, --help Prints help information
|
||||
|
||||
COMMANDS:
|
||||
animal The animal command
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user