From e9ebc9283f977cf8bf3298af79278327491d53cf Mon Sep 17 00:00:00 2001 From: Nick Lucas Date: Sun, 12 Feb 2017 13:58:16 +0000 Subject: [PATCH 01/13] Reorganise command and argument top-level logic into facade methods to make UserFacingException handling easier --- src/EntryPoint/Arguments/ArgumentFacade.cs | 25 ++++++++++++++++++++++ src/EntryPoint/Cli.cs | 19 ++-------------- src/EntryPoint/Commands/CommandFacade.cs | 14 ++++++++++++ 3 files changed, 41 insertions(+), 17 deletions(-) create mode 100644 src/EntryPoint/Arguments/ArgumentFacade.cs create mode 100644 src/EntryPoint/Commands/CommandFacade.cs diff --git a/src/EntryPoint/Arguments/ArgumentFacade.cs b/src/EntryPoint/Arguments/ArgumentFacade.cs new file mode 100644 index 0000000..19c3999 --- /dev/null +++ b/src/EntryPoint/Arguments/ArgumentFacade.cs @@ -0,0 +1,25 @@ +using EntryPoint.Parsing; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EntryPoint.Arguments { + internal static class ArgumentFacade { + public static A Parse(A applicationOptions, string[] args) where A : BaseCliArguments { + // Process inputs + ArgumentModel model = new ArgumentModel(applicationOptions); + var tokens = Tokeniser.MakeTokens(args); + ParseResult parseResult = Parser.MakeParseResult(tokens, model); + + // Map results + model = ArgumentMapper.MapOptions(model, parseResult); + + if (model.CliArguments.HelpInvoked) { + model.HelpFacade.Execute(); + } + + return (A)model.CliArguments; + } + } +} diff --git a/src/EntryPoint/Cli.cs b/src/EntryPoint/Cli.cs index d5f7565..e4da047 100644 --- a/src/EntryPoint/Cli.cs +++ b/src/EntryPoint/Cli.cs @@ -44,20 +44,7 @@ public static class Cli { /// The pre-instantiated CliArguments implementation /// The CLI arguments input public static A Parse(A applicationOptions, string[] args) where A : BaseCliArguments { - - // Process inputs - ArgumentModel model = new ArgumentModel(applicationOptions); - var tokens = Tokeniser.MakeTokens(args); - ParseResult parseResult = Parser.MakeParseResult(tokens, model); - - // Map results - model = ArgumentMapper.MapOptions(model, parseResult); - - if (model.CliArguments.HelpInvoked) { - model.HelpFacade.Execute(); - } - - return (A)model.CliArguments; + return ArgumentFacade.Parse(applicationOptions, args); } @@ -87,9 +74,7 @@ public static class Cli { /// An instance of the class implementing BaseCliCommands /// The CLI arguments input public static C Execute(C commands, string[] args) where C : BaseCliCommands { - var model = new CommandModel(commands); - model.Execute(args); - return commands; + return CommandFacade.Execute(commands, args); } diff --git a/src/EntryPoint/Commands/CommandFacade.cs b/src/EntryPoint/Commands/CommandFacade.cs new file mode 100644 index 0000000..ce1f4d5 --- /dev/null +++ b/src/EntryPoint/Commands/CommandFacade.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EntryPoint.Commands { + internal static class CommandFacade { + public static C Execute(C commands, string[] args) where C : BaseCliCommands { + var model = new CommandModel(commands); + model.Execute(args); + return commands; + } + } +} From 5496245a2fb8780a82edc967b75a2ffdc618e6c4 Mon Sep 17 00:00:00 2001 From: Nick Lucas Date: Sun, 12 Feb 2017 15:46:36 +0000 Subject: [PATCH 02/13] Change BaseHelpable to IHelpable and move default functionality to the baseclasses --- src/EntryPoint/BaseCliArguments.cs | 11 +++++++++-- src/EntryPoint/BaseCliCommands.cs | 11 +++++++++-- src/EntryPoint/Cli.cs | 6 +++--- src/EntryPoint/Help/BaseHelpable.cs | 24 ------------------------ src/EntryPoint/Help/HelpFacade.cs | 4 ++-- src/EntryPoint/Help/IHelpable.cs | 24 ++++++++++++++++++++++++ 6 files changed, 47 insertions(+), 33 deletions(-) delete mode 100644 src/EntryPoint/Help/BaseHelpable.cs create mode 100644 src/EntryPoint/Help/IHelpable.cs diff --git a/src/EntryPoint/BaseCliArguments.cs b/src/EntryPoint/BaseCliArguments.cs index 066c0af..fe70836 100644 --- a/src/EntryPoint/BaseCliArguments.cs +++ b/src/EntryPoint/BaseCliArguments.cs @@ -11,7 +11,7 @@ namespace EntryPoint { /// /// The base class which must be derived from for a CliArguments implementation /// - public abstract class BaseCliArguments : BaseHelpable { + public abstract class BaseCliArguments : IHelpable { /// /// The base class which must be derived from for CliArguments implementation /// @@ -33,7 +33,14 @@ public abstract class BaseCliArguments : BaseHelpable { ShortName: HelpRules.HelpShort)] [Help( "Displays Help information about arguments when set")] - public new bool HelpInvoked { get; set; } + public bool HelpInvoked { get; set; } + + public virtual void OnHelpInvoked(string helpText) { + Console.WriteLine(helpText); + Console.Write("Press enter to exit..."); + Console.ReadLine(); + Environment.Exit(0); + } } } diff --git a/src/EntryPoint/BaseCliCommands.cs b/src/EntryPoint/BaseCliCommands.cs index c3529d1..9da9875 100644 --- a/src/EntryPoint/BaseCliCommands.cs +++ b/src/EntryPoint/BaseCliCommands.cs @@ -12,8 +12,15 @@ namespace EntryPoint { /// /// The base class which must be derived from for a CliCommands implement /// - public abstract class BaseCliCommands : BaseHelpable { - + public abstract class BaseCliCommands : IHelpable { + public bool HelpInvoked { get; set; } + + public virtual void OnHelpInvoked(string helpText) { + Console.WriteLine(helpText); + Console.Write("Press enter to exit..."); + Console.ReadLine(); + Environment.Exit(0); + } } } diff --git a/src/EntryPoint/Cli.cs b/src/EntryPoint/Cli.cs index e4da047..2a9dd02 100644 --- a/src/EntryPoint/Cli.cs +++ b/src/EntryPoint/Cli.cs @@ -84,7 +84,7 @@ public static class Cli { /// Generate and return a Help string for a given BaseCliArguments or BaseCliCommands instance /// /// Custom implementation type of BaseCliArguments or BaseCliCommands which can be created with 0 arguments - public static string GetHelp() where A : BaseHelpable, new() { + public static string GetHelp() where A : IHelpable, new() { return GetHelp(new A()); } @@ -93,7 +93,7 @@ public static class Cli { /// /// Custom implementation type of BaseCliArguments or BaseCliCommands /// Instance of the custom BaseCliArguments or BaseCliCommands implementation - public static string GetHelp(A applicationOptions) where A : BaseHelpable { + public static string GetHelp(A applicationOptions) where A : IHelpable { if (applicationOptions is BaseCliArguments) { return CliArgumentsHelp.Generate( new ArgumentModel(applicationOptions as BaseCliArguments)); @@ -103,7 +103,7 @@ public static class Cli { new CommandModel(applicationOptions as BaseCliCommands)); } throw new InvalidOperationException( - $"Unknown {nameof(BaseHelpable)}: " + $"Unknown {nameof(IHelpable)}: " + $"{applicationOptions.GetType().Name}"); } diff --git a/src/EntryPoint/Help/BaseHelpable.cs b/src/EntryPoint/Help/BaseHelpable.cs deleted file mode 100644 index a9b1731..0000000 --- a/src/EntryPoint/Help/BaseHelpable.cs +++ /dev/null @@ -1,24 +0,0 @@ -using EntryPoint.Common; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace EntryPoint.Help { - public abstract class BaseHelpable { - internal BaseHelpable() { } - - public bool HelpInvoked { get; set; } - - /// - /// Invoked when the user invokes -h/--help - /// - /// The help string for this class - public virtual void OnHelpInvoked(string helpText) { - Console.WriteLine(helpText); - Console.Write("Press enter to exit..."); - Console.ReadLine(); - Environment.Exit(0); - } - } -} diff --git a/src/EntryPoint/Help/HelpFacade.cs b/src/EntryPoint/Help/HelpFacade.cs index b257969..89ad609 100644 --- a/src/EntryPoint/Help/HelpFacade.cs +++ b/src/EntryPoint/Help/HelpFacade.cs @@ -8,12 +8,12 @@ namespace EntryPoint.Help { internal class HelpFacade { - internal HelpFacade(BaseHelpable helpable) { + internal HelpFacade(IHelpable helpable) { Helpable = helpable; } // Command class to invoke on - protected BaseHelpable Helpable { get; set; } + protected IHelpable Helpable { get; set; } public void Execute(string message = null) { string spacer = message == null ? "" : "\n\n"; diff --git a/src/EntryPoint/Help/IHelpable.cs b/src/EntryPoint/Help/IHelpable.cs new file mode 100644 index 0000000..5b5aa1a --- /dev/null +++ b/src/EntryPoint/Help/IHelpable.cs @@ -0,0 +1,24 @@ +using EntryPoint.Common; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EntryPoint.Help { + public interface IHelpable { + // Set when the user invokes -h/--help + bool HelpInvoked { get; set; } + + /// + /// Invoked when the user invokes -h/--help + /// + /// The help string for this class + void OnHelpInvoked(string helpText); +//{ +// Console.WriteLine(helpText); +// Console.Write("Press enter to exit..."); +// Console.ReadLine(); +// Environment.Exit(0); +// } + } +} From c83e15dad2c087edd46248626977bc69d6b9d62d Mon Sep 17 00:00:00 2001 From: Nick Lucas Date: Sun, 12 Feb 2017 16:02:28 +0000 Subject: [PATCH 03/13] Add IUserFacingExceptionHandler interface --- .../Exceptions/IUserFacingExceptionHandler.cs | 11 +++++++++++ src/EntryPoint/Help/IHelpable.cs | 6 ------ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 src/EntryPoint/Exceptions/IUserFacingExceptionHandler.cs diff --git a/src/EntryPoint/Exceptions/IUserFacingExceptionHandler.cs b/src/EntryPoint/Exceptions/IUserFacingExceptionHandler.cs new file mode 100644 index 0000000..b2d2c7f --- /dev/null +++ b/src/EntryPoint/Exceptions/IUserFacingExceptionHandler.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EntryPoint.Exceptions { + interface IUserFacingExceptionHandler { + bool UserFacingExceptionThrown { get; set; } + void OnUserFacingException(UserFacingException e, string message); + } +} diff --git a/src/EntryPoint/Help/IHelpable.cs b/src/EntryPoint/Help/IHelpable.cs index 5b5aa1a..995ee2f 100644 --- a/src/EntryPoint/Help/IHelpable.cs +++ b/src/EntryPoint/Help/IHelpable.cs @@ -14,11 +14,5 @@ public interface IHelpable { /// /// The help string for this class void OnHelpInvoked(string helpText); -//{ -// Console.WriteLine(helpText); -// Console.Write("Press enter to exit..."); -// Console.ReadLine(); -// Environment.Exit(0); -// } } } From 4b1eea9fd0d2a1074aef4de25d57ca76774e7b0d Mon Sep 17 00:00:00 2001 From: Nick Lucas Date: Sun, 12 Feb 2017 16:14:38 +0000 Subject: [PATCH 04/13] Provide sane default implementation of interfaces on each BaseCli class --- src/EntryPoint/BaseCliArguments.cs | 20 +++++++++++++++++++- src/EntryPoint/BaseCliCommands.cs | 19 ++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/EntryPoint/BaseCliArguments.cs b/src/EntryPoint/BaseCliArguments.cs index fe70836..44c9d2c 100644 --- a/src/EntryPoint/BaseCliArguments.cs +++ b/src/EntryPoint/BaseCliArguments.cs @@ -5,13 +5,15 @@ using EntryPoint.Help; using EntryPoint.Common; +using EntryPoint.Exceptions; namespace EntryPoint { /// /// The base class which must be derived from for a CliArguments implementation /// - public abstract class BaseCliArguments : IHelpable { + public abstract class BaseCliArguments : IHelpable, IUserFacingExceptionHandler { + /// /// The base class which must be derived from for CliArguments implementation /// @@ -28,6 +30,9 @@ public abstract class BaseCliArguments : IHelpable { /// public string[] Operands { get; internal set; } + + // ** IHelpable ** + [Option( LongName: HelpRules.HelpLong, ShortName: HelpRules.HelpShort)] @@ -41,6 +46,19 @@ public abstract class BaseCliArguments : IHelpable { Console.ReadLine(); Environment.Exit(0); } + + + // ** IUserFacingExceptionHandler ** + + public bool UserFacingExceptionThrown { get; set; } + + public void OnUserFacingException(UserFacingException e, string message) { + Console.WriteLine(message); + Console.WriteLine("Press enter to exit..."); + Console.ReadLine(); + Environment.Exit(1); + } + } } diff --git a/src/EntryPoint/BaseCliCommands.cs b/src/EntryPoint/BaseCliCommands.cs index 9da9875..18b8daa 100644 --- a/src/EntryPoint/BaseCliCommands.cs +++ b/src/EntryPoint/BaseCliCommands.cs @@ -6,13 +6,17 @@ using EntryPoint.Commands; using EntryPoint.Help; using EntryPoint.Common; +using EntryPoint.Exceptions; namespace EntryPoint { /// /// The base class which must be derived from for a CliCommands implement /// - public abstract class BaseCliCommands : IHelpable { + public abstract class BaseCliCommands : IHelpable, IUserFacingExceptionHandler { + + // ** IHelpable ** + public bool HelpInvoked { get; set; } public virtual void OnHelpInvoked(string helpText) { @@ -21,6 +25,19 @@ public abstract class BaseCliCommands : IHelpable { Console.ReadLine(); Environment.Exit(0); } + + + // ** IUserFacingExceptionHandler ** + + public bool UserFacingExceptionThrown { get; set; } + + public virtual void OnUserFacingException(UserFacingException e, string message) { + Console.WriteLine(message); + Console.WriteLine("Press enter to exit..."); + Console.ReadLine(); + Environment.Exit(1); + } + } } From 6679aaab2b2bee21e470b8359f7fa7f47949daf9 Mon Sep 17 00:00:00 2001 From: Nick Lucas Date: Sun, 12 Feb 2017 16:40:44 +0000 Subject: [PATCH 05/13] Implement flow control for UserFacingExceptions for BaseCli classes --- src/EntryPoint/Arguments/ArgumentFacade.cs | 20 ++++++++++++++++---- src/EntryPoint/BaseCliArguments.cs | 13 +++++++------ src/EntryPoint/BaseCliCommands.cs | 13 +++++++------ src/EntryPoint/Commands/CommandFacade.cs | 14 ++++++++++++-- 4 files changed, 42 insertions(+), 18 deletions(-) diff --git a/src/EntryPoint/Arguments/ArgumentFacade.cs b/src/EntryPoint/Arguments/ArgumentFacade.cs index 19c3999..f9b9d1b 100644 --- a/src/EntryPoint/Arguments/ArgumentFacade.cs +++ b/src/EntryPoint/Arguments/ArgumentFacade.cs @@ -1,4 +1,5 @@ -using EntryPoint.Parsing; +using EntryPoint.Exceptions; +using EntryPoint.Parsing; using System; using System.Collections.Generic; using System.Linq; @@ -6,9 +7,20 @@ namespace EntryPoint.Arguments { internal static class ArgumentFacade { - public static A Parse(A applicationOptions, string[] args) where A : BaseCliArguments { + public static A Parse(A arguments, string[] args) where A : BaseCliArguments { + try { + ArgumentModel model = ParseArguments(arguments, args); + return (A)model.CliArguments; + } catch (UserFacingException e) { + arguments.UserFacingExceptionThrown = true; + arguments.OnUserFacingException(e, e.Message); + } + return arguments; + } + + private static ArgumentModel ParseArguments(A arguments, string[] args) where A : BaseCliArguments { // Process inputs - ArgumentModel model = new ArgumentModel(applicationOptions); + ArgumentModel model = new ArgumentModel(arguments); var tokens = Tokeniser.MakeTokens(args); ParseResult parseResult = Parser.MakeParseResult(tokens, model); @@ -19,7 +31,7 @@ internal static class ArgumentFacade { model.HelpFacade.Execute(); } - return (A)model.CliArguments; + return model; } } } diff --git a/src/EntryPoint/BaseCliArguments.cs b/src/EntryPoint/BaseCliArguments.cs index 44c9d2c..a25342a 100644 --- a/src/EntryPoint/BaseCliArguments.cs +++ b/src/EntryPoint/BaseCliArguments.cs @@ -52,12 +52,13 @@ public abstract class BaseCliArguments : IHelpable, IUserFacingExceptionHandler public bool UserFacingExceptionThrown { get; set; } - public void OnUserFacingException(UserFacingException e, string message) { - Console.WriteLine(message); - Console.WriteLine("Press enter to exit..."); - Console.ReadLine(); - Environment.Exit(1); - } + public abstract void OnUserFacingException(UserFacingException e, string message); + // { + // Console.WriteLine(message); + // Console.WriteLine("Press enter to exit..."); + // Console.ReadLine(); + // Environment.Exit(1); + //} } diff --git a/src/EntryPoint/BaseCliCommands.cs b/src/EntryPoint/BaseCliCommands.cs index 18b8daa..cd3d371 100644 --- a/src/EntryPoint/BaseCliCommands.cs +++ b/src/EntryPoint/BaseCliCommands.cs @@ -31,12 +31,13 @@ public abstract class BaseCliCommands : IHelpable, IUserFacingExceptionHandler { public bool UserFacingExceptionThrown { get; set; } - public virtual void OnUserFacingException(UserFacingException e, string message) { - Console.WriteLine(message); - Console.WriteLine("Press enter to exit..."); - Console.ReadLine(); - Environment.Exit(1); - } + public abstract void OnUserFacingException(UserFacingException e, string message); + //{ + // Console.WriteLine(message); + // Console.WriteLine("Press enter to exit..."); + // Console.ReadLine(); + // Environment.Exit(1); + //} } diff --git a/src/EntryPoint/Commands/CommandFacade.cs b/src/EntryPoint/Commands/CommandFacade.cs index ce1f4d5..138b378 100644 --- a/src/EntryPoint/Commands/CommandFacade.cs +++ b/src/EntryPoint/Commands/CommandFacade.cs @@ -1,4 +1,5 @@ -using System; +using EntryPoint.Exceptions; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -6,9 +7,18 @@ namespace EntryPoint.Commands { internal static class CommandFacade { public static C Execute(C commands, string[] args) where C : BaseCliCommands { + try { + ExecuteCommand(commands, args); + } catch (UserFacingException e) { + commands.UserFacingExceptionThrown = true; + commands.OnUserFacingException(e, e.Message); + } + return commands; + } + + private static void ExecuteCommand(C commands, string[] args) where C : BaseCliCommands { var model = new CommandModel(commands); model.Execute(args); - return commands; } } } From 73cc902a7004305c01b201d59ccb66800160c085 Mon Sep 17 00:00:00 2001 From: Nick Lucas Date: Sun, 12 Feb 2017 16:41:23 +0000 Subject: [PATCH 06/13] Fix test classes so tsts will fail --- docs-generation/Website/article_arguments.cs | 9 +++++++++ docs-generation/Website/article_commands.cs | 5 +++++ docs-generation/Website/article_help_generator.cs | 13 +++++++++++++ .../Arguments/AppOptionModels/BoolArgsModel.cs | 5 +++++ .../Arguments/AppOptionModels/DecimalArgsModel.cs | 5 +++++ .../AppOptionModels/DuplicateArgumentsModel.cs | 5 +++++ .../AppOptionModels/DuplicateDoubleModel.cs | 5 +++++ .../AppOptionModels/DuplicateHelpDoubleModel.cs | 5 +++++ .../AppOptionModels/DuplicateHelpSingleModel.cs | 5 +++++ .../AppOptionModels/DuplicateLimitsModel.cs | 5 +++++ .../AppOptionModels/DuplicateNoDoublesModel.cs | 5 +++++ .../AppOptionModels/DuplicateNoSinglesModel.cs | 5 +++++ .../AppOptionModels/DuplicateSimilarOptionsModel.cs | 5 +++++ .../AppOptionModels/DuplicateSingleModel.cs | 5 +++++ .../AppOptionModels/HelpWithRequiredArgsModel.cs | 5 +++++ .../Arguments/AppOptionModels/IntegerArgsModel.cs | 5 +++++ .../Arguments/AppOptionModels/ListsArgsModel.cs | 5 +++++ .../AppOptionModels/ListsNonStructModel.cs | 5 +++++ .../Arguments/AppOptionModels/ListsOperandsModel.cs | 5 +++++ .../Arguments/AppOptionModels/OperandArgsModel.cs | 5 +++++ .../Arguments/AppOptionModels/OperandDumpModel.cs | 5 +++++ .../OperandNonContiguousArgsModel.cs | 5 +++++ .../AppOptionModels/OperandRequiredArgsModel .cs | 5 +++++ .../AppOptionModels/OperandStartAt0ArgsModel.cs | 5 +++++ .../Arguments/AppOptionModels/OptionArgsModel.cs | 5 +++++ .../AppOptionModels/ParametersArgsModel.cs | 5 +++++ .../AppOptionModels/RequiredCliArguments.cs | 5 +++++ .../AppOptionModels/RequiredParameterArgsModel.cs | 5 +++++ .../AppOptionModels/SingleDashArgsModel.cs | 5 +++++ .../Arguments/AppOptionModels/StringArgsModel.cs | 5 +++++ .../EntryPointTests/Arguments/EnumArgumentsTests.cs | 5 +++++ .../ArgumentModel_RequiredOptions.cs | 5 +++++ .../BaseCommandsHelpers/CommandModel_Defaults.cs | 5 +++++ .../CommandModel_DuplicateNames.cs | 5 +++++ .../CommandModel_ExceptionThrow.cs | 5 +++++ .../BaseCommandsHelpers/CommandModel_Executable.cs | 5 +++++ .../BaseCommandsHelpers/CommandModel_Help.cs | 5 +++++ .../CommandModel_MethodSig_ManyArgs.cs | 5 +++++ .../CommandModel_MethodSig_NoArgs.cs | 5 +++++ .../BaseCommandsHelpers/CommandModel_NoDefaults.cs | 5 +++++ .../CommandModel_RequiredOptions.cs | 5 +++++ .../BaseCommandsHelpers/CommandModel_TwoDefaults.cs | 5 +++++ test/Example/CommandLine/ExampleCliCommands.cs | 5 +++++ test/Example/CommandLine/PrimaryCliArguments.cs | 5 +++++ test/Example/CommandLine/SecondaryCliArguments.cs | 5 +++++ 45 files changed, 237 insertions(+) diff --git a/docs-generation/Website/article_arguments.cs b/docs-generation/Website/article_arguments.cs index df721db..e8a89e3 100644 --- a/docs-generation/Website/article_arguments.cs +++ b/docs-generation/Website/article_arguments.cs @@ -5,6 +5,7 @@ using EntryPoint; using System.Collections.Generic; +using EntryPoint.Exceptions; namespace Website { class article_arguments { @@ -52,6 +53,10 @@ class SimpleCliArguments : BaseCliArguments { // un-mapped operands are stored [Operand(Position: 1)] public decimal FirstOperand { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } #endif @@ -139,6 +144,10 @@ class MessagingCliArguments : BaseCliArguments { [Required] [Operand(1)] public string Message { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } enum MessageImportanceEnum { diff --git a/docs-generation/Website/article_commands.cs b/docs-generation/Website/article_commands.cs index ac8c87d..941d800 100644 --- a/docs-generation/Website/article_commands.cs +++ b/docs-generation/Website/article_commands.cs @@ -5,6 +5,7 @@ using EntryPoint; using System.Collections.Generic; +using EntryPoint.Exceptions; namespace Website { class article_commands { @@ -45,6 +46,10 @@ class SimpleCliCommands : BaseCliCommands { // var arguments = Cli.Parse(args); // ...Application logic } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } #endif diff --git a/docs-generation/Website/article_help_generator.cs b/docs-generation/Website/article_help_generator.cs index bef774d..6825d79 100644 --- a/docs-generation/Website/article_help_generator.cs +++ b/docs-generation/Website/article_help_generator.cs @@ -5,6 +5,7 @@ using EntryPoint; using System.Collections.Generic; +using EntryPoint.Exceptions; namespace Website { class article_help_generator { @@ -39,6 +40,10 @@ class ExampleHelpCliCommands : BaseCliCommands { public void Command1(string[] args) { // ...etc } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } class CommandsHelpProgram { @@ -68,6 +73,10 @@ public ExampleHelpCliArguments() [OptionParameter(LongName: "value1")] [Help("Some value to set")] public bool Value1 { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } class ArgumentsHelpProgram { @@ -109,6 +118,10 @@ class OverrideHelpCliCommands : BaseCliCommands { Console.WriteLine(helpText); throw new HelpInvokedException("Using an exception to control application flow"); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } #endif class HelpInvokedException : Exception { diff --git a/test/EntryPointTests/Arguments/AppOptionModels/BoolArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/BoolArgsModel.cs index a7f7101..1e01725 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/BoolArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/BoolArgsModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class BoolArgsModel : BaseCliArguments { @@ -21,5 +22,9 @@ public class BoolArgsModel : BaseCliArguments { LongName: "default-true", ShortName: 'c')] public bool DefaultTrue { get; set; } = true; + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DecimalArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DecimalArgsModel.cs index a3f39c3..f3ebcee 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DecimalArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DecimalArgsModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class DecimalArgsModel : BaseCliArguments { @@ -21,5 +22,9 @@ public class DecimalArgsModel : BaseCliArguments { LongName: "default-71", ShortName: 'c')] public decimal Default71 { get; set; } = 7.1m; + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateArgumentsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateArgumentsModel.cs index 55b542b..1df1233 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateArgumentsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateArgumentsModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class DuplicateArgumentsModel : BaseCliArguments { @@ -12,5 +13,9 @@ public class DuplicateArgumentsModel : BaseCliArguments { [Option(LongName: "bravo", ShortName: 'A')] public bool Bravo { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateDoubleModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateDoubleModel.cs index 64145f7..3e38ea9 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateDoubleModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateDoubleModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class DuplicateDoubleModel : BaseCliArguments { @@ -12,5 +13,9 @@ public class DuplicateDoubleModel : BaseCliArguments { [OptionParameter(LongName: "Alpha", ShortName: 'b')] public int Bravo { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateHelpDoubleModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateHelpDoubleModel.cs index 16767e2..f6cdea2 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateHelpDoubleModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateHelpDoubleModel.cs @@ -4,10 +4,15 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class DuplicateHelpDoubleModel : BaseCliArguments { [Option(LongName: "help", ShortName: 'a')] public bool Alpha { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateHelpSingleModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateHelpSingleModel.cs index 4ca92d6..f15ad96 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateHelpSingleModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateHelpSingleModel.cs @@ -4,10 +4,15 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class DuplicateHelpSingleModel : BaseCliArguments { [Option(LongName: "alpha", ShortName: 'h')] public bool Alpha { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateLimitsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateLimitsModel.cs index 4b06c10..05db3d4 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateLimitsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateLimitsModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class DuplicateLimitsModel : BaseCliArguments { @@ -12,5 +13,9 @@ public class DuplicateLimitsModel : BaseCliArguments { [OptionParameter(LongName: "beta", ShortName: 'A')] public int Bravo { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateNoDoublesModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateNoDoublesModel.cs index 53ddee1..81e0164 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateNoDoublesModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateNoDoublesModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class DuplicateNoDoublesModel : BaseCliArguments { @@ -12,5 +13,9 @@ public class DuplicateNoDoublesModel : BaseCliArguments { [OptionParameter(LongName: "beta")] public int Bravo { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateNoSinglesModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateNoSinglesModel.cs index b56d2d8..288344c 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateNoSinglesModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateNoSinglesModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class DuplicateNoSinglesModel : BaseCliArguments { @@ -12,5 +13,9 @@ public class DuplicateNoSinglesModel : BaseCliArguments { [OptionParameter(LongName: "beta")] public int Bravo { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateSimilarOptionsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateSimilarOptionsModel.cs index ed201bd..6b74c6f 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateSimilarOptionsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateSimilarOptionsModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class DuplicateSimilarOptionsModel : BaseCliArguments { @@ -12,5 +13,9 @@ public class DuplicateSimilarOptionsModel : BaseCliArguments { [OptionParameter(LongName: "log-level")] public int LogLevel { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateSingleModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateSingleModel.cs index 7c1a2de..b71c1f0 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateSingleModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateSingleModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class DuplicateSingleModel : BaseCliArguments { @@ -12,5 +13,9 @@ public class DuplicateSingleModel : BaseCliArguments { [OptionParameter(LongName: "marys-double", ShortName: 'm')] public int MarysDouble { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/HelpWithRequiredArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/HelpWithRequiredArgsModel.cs index 90ce2f0..6ef0a82 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/HelpWithRequiredArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/HelpWithRequiredArgsModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; using EntryPointTests.Arguments.Helpers; namespace EntryPointTests.Arguments.AppOptionModels { @@ -29,5 +30,9 @@ public class HelpWithRequiredArgsModel : BaseCliArguments { public override void OnHelpInvoked(string helpText) { throw new HelpTriggeredSuccessException(); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/IntegerArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/IntegerArgsModel.cs index 66f6557..00dffbd 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/IntegerArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/IntegerArgsModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class IntegerArgsModel : BaseCliArguments { @@ -21,5 +22,9 @@ public class IntegerArgsModel : BaseCliArguments { LongName: "default-7", ShortName: 'c')] public int Default7 { get; set; } = 7; + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/ListsArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/ListsArgsModel.cs index 3507248..ee2e4b4 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/ListsArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/ListsArgsModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class ListsArgsModel : BaseCliArguments { @@ -18,5 +19,9 @@ public class ListsArgsModel : BaseCliArguments { [OptionParameter(LongName: "decimals")] public List Decimals { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/ListsNonStructModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/ListsNonStructModel.cs index 3dc267a..6e738fd 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/ListsNonStructModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/ListsNonStructModel.cs @@ -4,10 +4,15 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class ListsNonStructModel : BaseCliArguments { [OptionParameter(LongName: "class")] public List> Strings { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/ListsOperandsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/ListsOperandsModel.cs index a784746..c32e723 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/ListsOperandsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/ListsOperandsModel.cs @@ -4,10 +4,15 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class ListsOperandsModel : BaseCliArguments { [Operand(1)] public List Strings { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/OperandArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/OperandArgsModel.cs index f470de8..bf1988f 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/OperandArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/OperandArgsModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; using EntryPointTests.Arguments.Helpers; namespace EntryPointTests.Arguments.AppOptionModels { @@ -27,5 +28,9 @@ public class OperandArgsModel : BaseCliArguments { [Operand(4)] public Enum1 Enum { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/OperandDumpModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/OperandDumpModel.cs index 2cab0d7..e416571 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/OperandDumpModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/OperandDumpModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class OperandDumpModel : BaseCliArguments { @@ -18,5 +19,9 @@ public class OperandDumpModel : BaseCliArguments { [Option( LongName: "opt-1")] public bool Opt1 { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/OperandNonContiguousArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/OperandNonContiguousArgsModel.cs index 1a92e16..95e0b23 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/OperandNonContiguousArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/OperandNonContiguousArgsModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; using EntryPointTests.Arguments.Helpers; namespace EntryPointTests.Arguments.AppOptionModels { @@ -20,5 +21,9 @@ public class OperandNonContiguousArgsModel : BaseCliArguments { [Operand(4)] public Enum1 Enum { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/OperandRequiredArgsModel .cs b/test/EntryPointTests/Arguments/AppOptionModels/OperandRequiredArgsModel .cs index 652a65f..57b41b1 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/OperandRequiredArgsModel .cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/OperandRequiredArgsModel .cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; using EntryPointTests.Arguments.Helpers; namespace EntryPointTests.Arguments.AppOptionModels { @@ -11,5 +12,9 @@ public class OperandRequiredArgsModel : BaseCliArguments { [Operand(1)] [Required] public string Name { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/OperandStartAt0ArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/OperandStartAt0ArgsModel.cs index 7a2722a..d8322f3 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/OperandStartAt0ArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/OperandStartAt0ArgsModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; using EntryPointTests.Arguments.Helpers; namespace EntryPointTests.Arguments.AppOptionModels { @@ -20,5 +21,9 @@ public class OperandStartAt0ArgsModel : BaseCliArguments { [Operand(3)] public Enum1 Enum { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/OptionArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/OptionArgsModel.cs index 03b069a..a25105a 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/OptionArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/OptionArgsModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class OptionArgsModel : BaseCliArguments { @@ -11,5 +12,9 @@ public class OptionArgsModel : BaseCliArguments { LongName: "my-option", ShortName: 'o')] public bool Option { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/ParametersArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/ParametersArgsModel.cs index ca9b227..8425c6b 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/ParametersArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/ParametersArgsModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class ParametersArgsModel : BaseCliArguments { @@ -16,5 +17,9 @@ public class ParametersArgsModel : BaseCliArguments { LongName: "param-2", ShortName: 'b')] public int Param2 { get; set; } = 7; + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/RequiredCliArguments.cs b/test/EntryPointTests/Arguments/AppOptionModels/RequiredCliArguments.cs index 565e317..609ed34 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/RequiredCliArguments.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/RequiredCliArguments.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using EntryPointTests.Arguments.Helpers; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class RequiredCliArguments : BaseCliArguments { @@ -17,5 +18,9 @@ public class RequiredCliArguments : BaseCliArguments { public override void OnHelpInvoked(string helpText) { throw new HelpTriggeredSuccessException(); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/RequiredParameterArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/RequiredParameterArgsModel.cs index 2b0e4f2..d07b0d7 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/RequiredParameterArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/RequiredParameterArgsModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class RequiredParameterArgsModel : BaseCliArguments { @@ -17,5 +18,9 @@ public class RequiredParameterArgsModel : BaseCliArguments { LongName: "param-optional", ShortName: 'o')] public int ParamOptional { get; set; } = 7; + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/SingleDashArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/SingleDashArgsModel.cs index 1b1cd76..8760d40 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/SingleDashArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/SingleDashArgsModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class SingleDashArgsModel : BaseCliArguments { @@ -21,5 +22,9 @@ public class SingleDashArgsModel : BaseCliArguments { LongName: "opt3", ShortName: 'c')] public string Opt3 { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/StringArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/StringArgsModel.cs index 7f7ccfc..86e1321 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/StringArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/StringArgsModel.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments.AppOptionModels { public class StringArgsModel : BaseCliArguments { @@ -16,5 +17,9 @@ public class StringArgsModel : BaseCliArguments { LongName: "default-no-name", ShortName: 'b')] public string DefaultNoName { get; set; } = "NoName"; + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Arguments/EnumArgumentsTests.cs b/test/EntryPointTests/Arguments/EnumArgumentsTests.cs index 872b976..5162f7c 100644 --- a/test/EntryPointTests/Arguments/EnumArgumentsTests.cs +++ b/test/EntryPointTests/Arguments/EnumArgumentsTests.cs @@ -6,6 +6,7 @@ using EntryPoint; using Xunit; using EntryPointTests.Arguments.Helpers; +using EntryPoint.Exceptions; namespace EntryPointTests.Arguments { public class EnumArgumentsTests { @@ -66,5 +67,9 @@ class EnumAppOptions : BaseCliArguments { public override void OnHelpInvoked(string helpText) { throw new NotImplementedException(); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/ArgumentModel_RequiredOptions.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/ArgumentModel_RequiredOptions.cs index 175d99d..aa9b374 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/ArgumentModel_RequiredOptions.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/ArgumentModel_RequiredOptions.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using EntryPoint.Exceptions; namespace EntryPointTests.Commands.BaseCommandsHelpers { public class ArgumentModel_RequiredOptions : BaseCliArguments { @@ -13,5 +14,9 @@ public class ArgumentModel_RequiredOptions : BaseCliArguments { public override void OnHelpInvoked(string helpText) { throw new EntryPointTests.Arguments.Helpers.HelpTriggeredSuccessException(); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Defaults.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Defaults.cs index 1300cd1..ab8a253 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Defaults.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Defaults.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; using EntryPointTests.Commands.Helpers; namespace EntryPointTests.Commands.BaseCommandsHelpers { @@ -22,5 +23,9 @@ public class CommandModel_Defaults : BaseCliCommands { public override void OnHelpInvoked(string commandsHelpText) { throw new NotImplementedException(); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_DuplicateNames.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_DuplicateNames.cs index 01afeb3..d883559 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_DuplicateNames.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_DuplicateNames.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using EntryPoint.Exceptions; namespace EntryPointTests.Commands.BaseCommandsHelpers { public class CommandModel_DuplicateNames : BaseCliCommands { @@ -21,5 +22,9 @@ public class CommandModel_DuplicateNames : BaseCliCommands { public override void OnHelpInvoked(string commandsHelpText) { throw new NotImplementedException(); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_ExceptionThrow.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_ExceptionThrow.cs index 4ae88c4..42df12d 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_ExceptionThrow.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_ExceptionThrow.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; using EntryPointTests.Commands.Helpers; namespace EntryPointTests.Commands.BaseCommandsHelpers { @@ -29,5 +30,9 @@ public class CommandModel_ExceptionThrow : BaseCliCommands { private void Layer1() { throw new DivideByZeroException(); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Executable.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Executable.cs index babb12a..f5c9c4d 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Executable.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Executable.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; using EntryPointTests.Commands.Helpers; namespace EntryPointTests.Commands.BaseCommandsHelpers { @@ -22,5 +23,9 @@ public class CommandModel_Executable : BaseCliCommands { public override void OnHelpInvoked(string commandsHelpText) { throw new CommandExecutedException("HELP"); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Help.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Help.cs index 25055fb..b203dcc 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Help.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Help.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; using EntryPointTests.Commands.Helpers; namespace EntryPointTests.Commands.BaseCommandsHelpers { @@ -22,5 +23,9 @@ public class CommandModel_Help : BaseCliCommands { public override void OnHelpInvoked(string commandsHelpText) { throw new CommandExecutedException("HELP"); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_MethodSig_ManyArgs.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_MethodSig_ManyArgs.cs index dbcc7bd..b4e5ca9 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_MethodSig_ManyArgs.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_MethodSig_ManyArgs.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using EntryPoint.Exceptions; namespace EntryPointTests.Commands.BaseCommandsHelpers { public class CommandModel_MethodSig_ManyArgs : BaseCliCommands { @@ -15,5 +16,9 @@ public class CommandModel_MethodSig_ManyArgs : BaseCliCommands { public override void OnHelpInvoked(string commandsHelpText) { throw new NotImplementedException(); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_MethodSig_NoArgs.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_MethodSig_NoArgs.cs index 70ad08a..7824c38 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_MethodSig_NoArgs.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_MethodSig_NoArgs.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using EntryPoint.Exceptions; namespace EntryPointTests.Commands.BaseCommandsHelpers { public class CommandModel_MethodSig_NoArgs : BaseCliCommands { @@ -15,5 +16,9 @@ public class CommandModel_MethodSig_NoArgs : BaseCliCommands { public override void OnHelpInvoked(string commandsHelpText) { throw new NotImplementedException(); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_NoDefaults.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_NoDefaults.cs index 28b3e84..16cb704 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_NoDefaults.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_NoDefaults.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; using EntryPointTests.Commands.Helpers; namespace EntryPointTests.Commands.BaseCommandsHelpers { @@ -21,5 +22,9 @@ public class CommandModel_NoDefaults : BaseCliCommands { public override void OnHelpInvoked(string commandsHelpText) { throw new CommandExecutedException("HELP"); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_RequiredOptions.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_RequiredOptions.cs index 734d05c..ca4b373 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_RequiredOptions.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_RequiredOptions.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using EntryPoint.Exceptions; namespace EntryPointTests.Commands.BaseCommandsHelpers { public class CommandModel_RequiredOptions : BaseCliCommands { @@ -11,5 +12,9 @@ public class CommandModel_RequiredOptions : BaseCliCommands { var a = Cli.Parse(args); throw new Helpers.CommandExecutedException(a.MyOption.ToString()); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_TwoDefaults.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_TwoDefaults.cs index f12429c..d6cae53 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_TwoDefaults.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_TwoDefaults.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; using EntryPointTests.Commands.Helpers; namespace EntryPointTests.Commands.BaseCommandsHelpers { @@ -23,5 +24,9 @@ public class CommandModel_TwoDefaults : BaseCliCommands { public override void OnHelpInvoked(string commandsHelpText) { throw new NotImplementedException(); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/Example/CommandLine/ExampleCliCommands.cs b/test/Example/CommandLine/ExampleCliCommands.cs index 9cf2394..0c005c2 100644 --- a/test/Example/CommandLine/ExampleCliCommands.cs +++ b/test/Example/CommandLine/ExampleCliCommands.cs @@ -4,9 +4,14 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace Example.CommandLine { public class ExampleCliCommands : BaseCliCommands { + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } + [DefaultCommand] [Command("primary")] [Help("The Main command, for doing something")] diff --git a/test/Example/CommandLine/PrimaryCliArguments.cs b/test/Example/CommandLine/PrimaryCliArguments.cs index fc59851..fba34a1 100644 --- a/test/Example/CommandLine/PrimaryCliArguments.cs +++ b/test/Example/CommandLine/PrimaryCliArguments.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using EntryPoint.Exceptions; namespace Example.CommandLine { [Help("This program is intended to show off the key features of EntryPoint, " @@ -62,5 +63,9 @@ public class PrimaryCliArguments : BaseCliArguments { [Operand(Position: 2)] [Help("A test list, used when checking help-generator output")] public List ListOperands { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } diff --git a/test/Example/CommandLine/SecondaryCliArguments.cs b/test/Example/CommandLine/SecondaryCliArguments.cs index a45cb3c..6c72049 100644 --- a/test/Example/CommandLine/SecondaryCliArguments.cs +++ b/test/Example/CommandLine/SecondaryCliArguments.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using EntryPoint; +using EntryPoint.Exceptions; namespace Example.CommandLine { public class SecondaryCliArguments : BaseCliArguments { @@ -14,5 +15,9 @@ public class SecondaryCliArguments : BaseCliArguments { Console.WriteLine(helpText); throw new Exception("Broke flow via Exception"); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } } From be95409cf112f1efa7dd422b170174cf16e6349b Mon Sep 17 00:00:00 2001 From: Nick Lucas Date: Sun, 12 Feb 2017 16:55:47 +0000 Subject: [PATCH 07/13] Rethrow exceptions in test classes --- test/EntryPointTests/Arguments/AppOptionModels/BoolArgsModel.cs | 2 +- .../Arguments/AppOptionModels/DecimalArgsModel.cs | 2 +- .../Arguments/AppOptionModels/DuplicateArgumentsModel.cs | 2 +- .../Arguments/AppOptionModels/DuplicateDoubleModel.cs | 2 +- .../Arguments/AppOptionModels/DuplicateHelpDoubleModel.cs | 2 +- .../Arguments/AppOptionModels/DuplicateHelpSingleModel.cs | 2 +- .../Arguments/AppOptionModels/DuplicateLimitsModel.cs | 2 +- .../Arguments/AppOptionModels/DuplicateNoDoublesModel.cs | 2 +- .../Arguments/AppOptionModels/DuplicateNoSinglesModel.cs | 2 +- .../Arguments/AppOptionModels/DuplicateSimilarOptionsModel.cs | 2 +- .../Arguments/AppOptionModels/DuplicateSingleModel.cs | 2 +- .../Arguments/AppOptionModels/HelpWithRequiredArgsModel.cs | 2 +- .../Arguments/AppOptionModels/IntegerArgsModel.cs | 2 +- .../EntryPointTests/Arguments/AppOptionModels/ListsArgsModel.cs | 2 +- .../Arguments/AppOptionModels/ListsNonStructModel.cs | 2 +- .../Arguments/AppOptionModels/ListsOperandsModel.cs | 2 +- .../Arguments/AppOptionModels/OperandArgsModel.cs | 2 +- .../Arguments/AppOptionModels/OperandDumpModel.cs | 2 +- .../Arguments/AppOptionModels/OperandNonContiguousArgsModel.cs | 2 +- .../Arguments/AppOptionModels/OperandRequiredArgsModel .cs | 2 +- .../Arguments/AppOptionModels/OperandStartAt0ArgsModel.cs | 2 +- .../Arguments/AppOptionModels/OptionArgsModel.cs | 2 +- .../Arguments/AppOptionModels/ParametersArgsModel.cs | 2 +- .../Arguments/AppOptionModels/RequiredCliArguments.cs | 2 +- .../Arguments/AppOptionModels/RequiredParameterArgsModel.cs | 2 +- .../Arguments/AppOptionModels/SingleDashArgsModel.cs | 2 +- .../Arguments/AppOptionModels/StringArgsModel.cs | 2 +- test/EntryPointTests/Arguments/EnumArgumentsTests.cs | 2 +- .../BaseCommandsHelpers/ArgumentModel_RequiredOptions.cs | 2 +- .../Commands/BaseCommandsHelpers/CommandModel_Defaults.cs | 2 +- .../Commands/BaseCommandsHelpers/CommandModel_DuplicateNames.cs | 2 +- .../Commands/BaseCommandsHelpers/CommandModel_ExceptionThrow.cs | 2 +- .../Commands/BaseCommandsHelpers/CommandModel_Executable.cs | 2 +- .../Commands/BaseCommandsHelpers/CommandModel_Help.cs | 2 +- .../BaseCommandsHelpers/CommandModel_MethodSig_ManyArgs.cs | 2 +- .../BaseCommandsHelpers/CommandModel_MethodSig_NoArgs.cs | 2 +- .../Commands/BaseCommandsHelpers/CommandModel_NoDefaults.cs | 2 +- .../BaseCommandsHelpers/CommandModel_RequiredOptions.cs | 2 +- .../Commands/BaseCommandsHelpers/CommandModel_TwoDefaults.cs | 2 +- test/Example/CommandLine/ExampleCliCommands.cs | 2 +- test/Example/CommandLine/PrimaryCliArguments.cs | 2 +- test/Example/CommandLine/SecondaryCliArguments.cs | 2 +- 42 files changed, 42 insertions(+), 42 deletions(-) diff --git a/test/EntryPointTests/Arguments/AppOptionModels/BoolArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/BoolArgsModel.cs index 1e01725..f6579e3 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/BoolArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/BoolArgsModel.cs @@ -24,7 +24,7 @@ public class BoolArgsModel : BaseCliArguments { public bool DefaultTrue { get; set; } = true; public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DecimalArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DecimalArgsModel.cs index f3ebcee..9ce3fdc 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DecimalArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DecimalArgsModel.cs @@ -24,7 +24,7 @@ public class DecimalArgsModel : BaseCliArguments { public decimal Default71 { get; set; } = 7.1m; public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateArgumentsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateArgumentsModel.cs index 1df1233..2e5cc63 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateArgumentsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateArgumentsModel.cs @@ -15,7 +15,7 @@ public class DuplicateArgumentsModel : BaseCliArguments { public bool Bravo { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateDoubleModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateDoubleModel.cs index 3e38ea9..0dfd32f 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateDoubleModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateDoubleModel.cs @@ -15,7 +15,7 @@ public class DuplicateDoubleModel : BaseCliArguments { public int Bravo { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateHelpDoubleModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateHelpDoubleModel.cs index f6cdea2..71c6e58 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateHelpDoubleModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateHelpDoubleModel.cs @@ -12,7 +12,7 @@ public class DuplicateHelpDoubleModel : BaseCliArguments { public bool Alpha { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateHelpSingleModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateHelpSingleModel.cs index f15ad96..9b28eed 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateHelpSingleModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateHelpSingleModel.cs @@ -12,7 +12,7 @@ public class DuplicateHelpSingleModel : BaseCliArguments { public bool Alpha { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateLimitsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateLimitsModel.cs index 05db3d4..191417f 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateLimitsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateLimitsModel.cs @@ -15,7 +15,7 @@ public class DuplicateLimitsModel : BaseCliArguments { public int Bravo { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateNoDoublesModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateNoDoublesModel.cs index 81e0164..0c8f8dc 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateNoDoublesModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateNoDoublesModel.cs @@ -15,7 +15,7 @@ public class DuplicateNoDoublesModel : BaseCliArguments { public int Bravo { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateNoSinglesModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateNoSinglesModel.cs index 288344c..e09ff80 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateNoSinglesModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateNoSinglesModel.cs @@ -15,7 +15,7 @@ public class DuplicateNoSinglesModel : BaseCliArguments { public int Bravo { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateSimilarOptionsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateSimilarOptionsModel.cs index 6b74c6f..f82bbd1 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateSimilarOptionsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateSimilarOptionsModel.cs @@ -15,7 +15,7 @@ public class DuplicateSimilarOptionsModel : BaseCliArguments { public int LogLevel { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateSingleModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateSingleModel.cs index b71c1f0..fc3bc8e 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/DuplicateSingleModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/DuplicateSingleModel.cs @@ -15,7 +15,7 @@ public class DuplicateSingleModel : BaseCliArguments { public int MarysDouble { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/HelpWithRequiredArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/HelpWithRequiredArgsModel.cs index 6ef0a82..223ec08 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/HelpWithRequiredArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/HelpWithRequiredArgsModel.cs @@ -32,7 +32,7 @@ public class HelpWithRequiredArgsModel : BaseCliArguments { } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/IntegerArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/IntegerArgsModel.cs index 00dffbd..bb30648 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/IntegerArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/IntegerArgsModel.cs @@ -24,7 +24,7 @@ public class IntegerArgsModel : BaseCliArguments { public int Default7 { get; set; } = 7; public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/ListsArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/ListsArgsModel.cs index ee2e4b4..3942ed6 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/ListsArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/ListsArgsModel.cs @@ -21,7 +21,7 @@ public class ListsArgsModel : BaseCliArguments { public List Decimals { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/ListsNonStructModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/ListsNonStructModel.cs index 6e738fd..99d77ea 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/ListsNonStructModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/ListsNonStructModel.cs @@ -12,7 +12,7 @@ public class ListsNonStructModel : BaseCliArguments { public List> Strings { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/ListsOperandsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/ListsOperandsModel.cs index c32e723..5d3ea52 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/ListsOperandsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/ListsOperandsModel.cs @@ -12,7 +12,7 @@ public class ListsOperandsModel : BaseCliArguments { public List Strings { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/OperandArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/OperandArgsModel.cs index bf1988f..fd93b1e 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/OperandArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/OperandArgsModel.cs @@ -30,7 +30,7 @@ public class OperandArgsModel : BaseCliArguments { public Enum1 Enum { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/OperandDumpModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/OperandDumpModel.cs index e416571..79430c8 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/OperandDumpModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/OperandDumpModel.cs @@ -21,7 +21,7 @@ public class OperandDumpModel : BaseCliArguments { public bool Opt1 { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/OperandNonContiguousArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/OperandNonContiguousArgsModel.cs index 95e0b23..8a34221 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/OperandNonContiguousArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/OperandNonContiguousArgsModel.cs @@ -23,7 +23,7 @@ public class OperandNonContiguousArgsModel : BaseCliArguments { public Enum1 Enum { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/OperandRequiredArgsModel .cs b/test/EntryPointTests/Arguments/AppOptionModels/OperandRequiredArgsModel .cs index 57b41b1..bdabb9f 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/OperandRequiredArgsModel .cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/OperandRequiredArgsModel .cs @@ -14,7 +14,7 @@ public class OperandRequiredArgsModel : BaseCliArguments { public string Name { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/OperandStartAt0ArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/OperandStartAt0ArgsModel.cs index d8322f3..2d066e2 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/OperandStartAt0ArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/OperandStartAt0ArgsModel.cs @@ -23,7 +23,7 @@ public class OperandStartAt0ArgsModel : BaseCliArguments { public Enum1 Enum { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/OptionArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/OptionArgsModel.cs index a25105a..2e909f1 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/OptionArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/OptionArgsModel.cs @@ -14,7 +14,7 @@ public class OptionArgsModel : BaseCliArguments { public bool Option { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/ParametersArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/ParametersArgsModel.cs index 8425c6b..6628fe9 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/ParametersArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/ParametersArgsModel.cs @@ -19,7 +19,7 @@ public class ParametersArgsModel : BaseCliArguments { public int Param2 { get; set; } = 7; public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/RequiredCliArguments.cs b/test/EntryPointTests/Arguments/AppOptionModels/RequiredCliArguments.cs index 609ed34..b44de10 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/RequiredCliArguments.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/RequiredCliArguments.cs @@ -20,7 +20,7 @@ public class RequiredCliArguments : BaseCliArguments { } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/RequiredParameterArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/RequiredParameterArgsModel.cs index d07b0d7..db6cfc0 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/RequiredParameterArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/RequiredParameterArgsModel.cs @@ -20,7 +20,7 @@ public class RequiredParameterArgsModel : BaseCliArguments { public int ParamOptional { get; set; } = 7; public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/SingleDashArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/SingleDashArgsModel.cs index 8760d40..92af5c7 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/SingleDashArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/SingleDashArgsModel.cs @@ -24,7 +24,7 @@ public class SingleDashArgsModel : BaseCliArguments { public string Opt3 { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/AppOptionModels/StringArgsModel.cs b/test/EntryPointTests/Arguments/AppOptionModels/StringArgsModel.cs index 86e1321..90811cf 100644 --- a/test/EntryPointTests/Arguments/AppOptionModels/StringArgsModel.cs +++ b/test/EntryPointTests/Arguments/AppOptionModels/StringArgsModel.cs @@ -19,7 +19,7 @@ public class StringArgsModel : BaseCliArguments { public string DefaultNoName { get; set; } = "NoName"; public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Arguments/EnumArgumentsTests.cs b/test/EntryPointTests/Arguments/EnumArgumentsTests.cs index 5162f7c..6b9083f 100644 --- a/test/EntryPointTests/Arguments/EnumArgumentsTests.cs +++ b/test/EntryPointTests/Arguments/EnumArgumentsTests.cs @@ -69,7 +69,7 @@ class EnumAppOptions : BaseCliArguments { } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/ArgumentModel_RequiredOptions.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/ArgumentModel_RequiredOptions.cs index aa9b374..3a86436 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/ArgumentModel_RequiredOptions.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/ArgumentModel_RequiredOptions.cs @@ -16,7 +16,7 @@ public class ArgumentModel_RequiredOptions : BaseCliArguments { } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Defaults.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Defaults.cs index ab8a253..1b27700 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Defaults.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Defaults.cs @@ -25,7 +25,7 @@ public class CommandModel_Defaults : BaseCliCommands { } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_DuplicateNames.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_DuplicateNames.cs index d883559..7591a47 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_DuplicateNames.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_DuplicateNames.cs @@ -24,7 +24,7 @@ public class CommandModel_DuplicateNames : BaseCliCommands { } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_ExceptionThrow.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_ExceptionThrow.cs index 42df12d..1632d53 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_ExceptionThrow.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_ExceptionThrow.cs @@ -32,7 +32,7 @@ public class CommandModel_ExceptionThrow : BaseCliCommands { } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Executable.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Executable.cs index f5c9c4d..3d9db1c 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Executable.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Executable.cs @@ -25,7 +25,7 @@ public class CommandModel_Executable : BaseCliCommands { } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Help.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Help.cs index b203dcc..6734ef5 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Help.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_Help.cs @@ -25,7 +25,7 @@ public class CommandModel_Help : BaseCliCommands { } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_MethodSig_ManyArgs.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_MethodSig_ManyArgs.cs index b4e5ca9..0d3540b 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_MethodSig_ManyArgs.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_MethodSig_ManyArgs.cs @@ -18,7 +18,7 @@ public class CommandModel_MethodSig_ManyArgs : BaseCliCommands { } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_MethodSig_NoArgs.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_MethodSig_NoArgs.cs index 7824c38..2746425 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_MethodSig_NoArgs.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_MethodSig_NoArgs.cs @@ -18,7 +18,7 @@ public class CommandModel_MethodSig_NoArgs : BaseCliCommands { } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_NoDefaults.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_NoDefaults.cs index 16cb704..067f5e8 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_NoDefaults.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_NoDefaults.cs @@ -24,7 +24,7 @@ public class CommandModel_NoDefaults : BaseCliCommands { } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_RequiredOptions.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_RequiredOptions.cs index ca4b373..8b8c5cf 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_RequiredOptions.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_RequiredOptions.cs @@ -14,7 +14,7 @@ public class CommandModel_RequiredOptions : BaseCliCommands { } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_TwoDefaults.cs b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_TwoDefaults.cs index d6cae53..450e69c 100644 --- a/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_TwoDefaults.cs +++ b/test/EntryPointTests/Commands/BaseCommandsHelpers/CommandModel_TwoDefaults.cs @@ -26,7 +26,7 @@ public class CommandModel_TwoDefaults : BaseCliCommands { } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/Example/CommandLine/ExampleCliCommands.cs b/test/Example/CommandLine/ExampleCliCommands.cs index 0c005c2..b3437ee 100644 --- a/test/Example/CommandLine/ExampleCliCommands.cs +++ b/test/Example/CommandLine/ExampleCliCommands.cs @@ -9,7 +9,7 @@ namespace Example.CommandLine { public class ExampleCliCommands : BaseCliCommands { public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } [DefaultCommand] diff --git a/test/Example/CommandLine/PrimaryCliArguments.cs b/test/Example/CommandLine/PrimaryCliArguments.cs index fba34a1..53f8112 100644 --- a/test/Example/CommandLine/PrimaryCliArguments.cs +++ b/test/Example/CommandLine/PrimaryCliArguments.cs @@ -65,7 +65,7 @@ public class PrimaryCliArguments : BaseCliArguments { public List ListOperands { get; set; } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } diff --git a/test/Example/CommandLine/SecondaryCliArguments.cs b/test/Example/CommandLine/SecondaryCliArguments.cs index 6c72049..d25303e 100644 --- a/test/Example/CommandLine/SecondaryCliArguments.cs +++ b/test/Example/CommandLine/SecondaryCliArguments.cs @@ -17,7 +17,7 @@ public class SecondaryCliArguments : BaseCliArguments { } public override void OnUserFacingException(UserFacingException e, string message) { - throw new NotImplementedException(); + throw e; } } } From 4372b9d76a7dd076abff11186fe425abb202e099 Mon Sep 17 00:00:00 2001 From: Nick Lucas Date: Sun, 12 Feb 2017 17:00:48 +0000 Subject: [PATCH 08/13] Return interface implementation to virtual, from abstract, and clean up --- src/EntryPoint/BaseCliArguments.cs | 13 ++++++------- src/EntryPoint/BaseCliCommands.cs | 17 ++++++++--------- test/Example/CommandLine/ExampleCliCommands.cs | 4 ---- test/Example/CommandLine/PrimaryCliArguments.cs | 4 ---- .../CommandLine/SecondaryCliArguments.cs | 4 ---- 5 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/EntryPoint/BaseCliArguments.cs b/src/EntryPoint/BaseCliArguments.cs index a25342a..4cc4e9a 100644 --- a/src/EntryPoint/BaseCliArguments.cs +++ b/src/EntryPoint/BaseCliArguments.cs @@ -52,13 +52,12 @@ public abstract class BaseCliArguments : IHelpable, IUserFacingExceptionHandler public bool UserFacingExceptionThrown { get; set; } - public abstract void OnUserFacingException(UserFacingException e, string message); - // { - // Console.WriteLine(message); - // Console.WriteLine("Press enter to exit..."); - // Console.ReadLine(); - // Environment.Exit(1); - //} + public virtual void OnUserFacingException(UserFacingException e, string message) { + Console.WriteLine(message); + Console.WriteLine("Press enter to exit..."); + Console.ReadLine(); + Environment.Exit(1); + } } diff --git a/src/EntryPoint/BaseCliCommands.cs b/src/EntryPoint/BaseCliCommands.cs index cd3d371..e88b8f1 100644 --- a/src/EntryPoint/BaseCliCommands.cs +++ b/src/EntryPoint/BaseCliCommands.cs @@ -31,14 +31,13 @@ public abstract class BaseCliCommands : IHelpable, IUserFacingExceptionHandler { public bool UserFacingExceptionThrown { get; set; } - public abstract void OnUserFacingException(UserFacingException e, string message); - //{ - // Console.WriteLine(message); - // Console.WriteLine("Press enter to exit..."); - // Console.ReadLine(); - // Environment.Exit(1); - //} - - } + public virtual void OnUserFacingException(UserFacingException e, string message) { + Console.WriteLine(message); + Console.WriteLine("Press enter to exit..."); + Console.ReadLine(); + Environment.Exit(1); + } + +} } diff --git a/test/Example/CommandLine/ExampleCliCommands.cs b/test/Example/CommandLine/ExampleCliCommands.cs index b3437ee..6bc5b76 100644 --- a/test/Example/CommandLine/ExampleCliCommands.cs +++ b/test/Example/CommandLine/ExampleCliCommands.cs @@ -8,10 +8,6 @@ namespace Example.CommandLine { public class ExampleCliCommands : BaseCliCommands { - public override void OnUserFacingException(UserFacingException e, string message) { - throw e; - } - [DefaultCommand] [Command("primary")] [Help("The Main command, for doing something")] diff --git a/test/Example/CommandLine/PrimaryCliArguments.cs b/test/Example/CommandLine/PrimaryCliArguments.cs index 53f8112..726291f 100644 --- a/test/Example/CommandLine/PrimaryCliArguments.cs +++ b/test/Example/CommandLine/PrimaryCliArguments.cs @@ -63,9 +63,5 @@ public class PrimaryCliArguments : BaseCliArguments { [Operand(Position: 2)] [Help("A test list, used when checking help-generator output")] public List ListOperands { get; set; } - - public override void OnUserFacingException(UserFacingException e, string message) { - throw e; - } } } diff --git a/test/Example/CommandLine/SecondaryCliArguments.cs b/test/Example/CommandLine/SecondaryCliArguments.cs index d25303e..a772246 100644 --- a/test/Example/CommandLine/SecondaryCliArguments.cs +++ b/test/Example/CommandLine/SecondaryCliArguments.cs @@ -15,9 +15,5 @@ public class SecondaryCliArguments : BaseCliArguments { Console.WriteLine(helpText); throw new Exception("Broke flow via Exception"); } - - public override void OnUserFacingException(UserFacingException e, string message) { - throw e; - } } } From f795acf3f93bfb7642f366ced76b07c3447299bf Mon Sep 17 00:00:00 2001 From: Nick Lucas Date: Sun, 12 Feb 2017 18:02:28 +0000 Subject: [PATCH 09/13] Update documentation with new article on user exception handling --- .../Website/article_user_facing_exceptions.cs | 117 ++++++++++++++++++ docs-generation/Website/www/arguments.md | 8 ++ docs-generation/Website/www/commands.md | 4 + docs-generation/Website/www/help_generator.md | 12 ++ .../Website/www/user_facing_exceptions.md | 102 +++++++++++++++ docs-generation/docfx/api/.manifest | 2 +- docs-generation/docfx/articles/arguments.md | 8 ++ docs-generation/docfx/articles/commands.md | 4 + .../docfx/articles/help_generator.md | 12 ++ docs-generation/docfx/articles/toc.yml | 2 + .../docfx/articles/user_facing_exceptions.md | 102 +++++++++++++++ 11 files changed, 372 insertions(+), 1 deletion(-) create mode 100644 docs-generation/Website/article_user_facing_exceptions.cs create mode 100644 docs-generation/Website/www/user_facing_exceptions.md create mode 100644 docs-generation/docfx/articles/user_facing_exceptions.md diff --git a/docs-generation/Website/article_user_facing_exceptions.cs b/docs-generation/Website/article_user_facing_exceptions.cs new file mode 100644 index 0000000..af55a43 --- /dev/null +++ b/docs-generation/Website/article_user_facing_exceptions.cs @@ -0,0 +1,117 @@ +#define CODE + +using System; +using System.Linq; + +using EntryPoint; +using System.Collections.Generic; +using EntryPoint.Exceptions; + +namespace Website { + class article_user_facing_exceptions { + /// ## User Facing Exceptions + /// + /// When a user makes a mistake, EntryPoint will throw an exception which derives from UserFacingException. + /// + /// This exception is caught and the following takes place on the relevant CliCommands or CliArguments instance + /// * `.UserFacingExceptionThrown` is set to `true` + /// * the virtual method `.OnUserFacingException(UserFacingException e, string message)` is called + /// + /// The virtual method contains a sane default implementation which prints to screen and exits the application. + /// + /// + /// #### Custom OnUserFacingException Handler + /// + /// If you want your own implementation you can override this, like so + /// +#if CODE + class CliArguments : BaseCliArguments { + public CliArguments() : base("Test") { } + + [Option(LongName: "Option", + ShortName: 'o')] + public bool Option { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + // your own handling of the message for the user + Console.WriteLine("User error: " + message); + } + } + + class UserFacingExceptionProgram { + public void main(string[] args) { + var arguments = Cli.Parse(args); + // Execution would not reach this point if the user provides invalid arguments, + // since OnUserFacingException would run and exit the program + + // However, if you override OnUserFacingException and don't exit, + // you could also do this: + if (arguments.UserFacingExceptionThrown) { + // Return here, or run something else + } + + // Normal Post-Arguments Application code... + } + } +#endif + + /// #### UserFacingException Bubbling + /// + /// If your application utilises both CliCommands and CliArguments, + /// you may want to handle UserFacingExceptions only on the CliCommands level. + /// + /// This can be achieved using bubbling. + /// + /// Simply override OnUserFacingException in your CliArguments implementations and re-throw the exception. + /// The exception will then be caught at the CliCommands level. + /// +#if CODE + class BubblingCliArguments : BaseCliArguments { + public BubblingCliArguments() : base("Test") { } + + [Option(LongName: "Option", + ShortName: 'o')] + public bool Option { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + // Re-throw the exception, causing it to bubble up to the root command + throw e; + } + } + + class BubblingCliCommands : BaseCliCommands{ + + [Command("command1")] + public void Command1(string[] args) { + var arguments = Cli.Parse(args); + + // Normal Post-Arguments application logic + } + + public override void OnUserFacingException(UserFacingException e, string message) { + // All UserFacingException throws will now come to here + Console.WriteLine("User error: " + message); + Console.ReadLine(); + Environment.Exit(1); + } + } + + class BubblingProgram { + public void main(string[] args) { + var commands = Cli.Execute(args); + // Execution would not reach this point when the user provides invalid + // commands or arguments, since our custom OnUserFacingException handler + // would run and exit the program + + // However, if you override OnUserFacingException and don't exit, + // you could also do this: + if (commands.UserFacingExceptionThrown) { + // Return here, or run something else + } + + // Normal Post-Command Application code... + } + } +#endif + } +} \ No newline at end of file diff --git a/docs-generation/Website/www/arguments.md b/docs-generation/Website/www/arguments.md index 85c6216..fade945 100644 --- a/docs-generation/Website/www/arguments.md +++ b/docs-generation/Website/www/arguments.md @@ -42,6 +42,10 @@ This has one Option `-s`, one OptionParameter `--name Bob` and a positional Oper // un-mapped operands are stored [Operand(Position: 1)] public decimal FirstOperand { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } #### Attributes @@ -126,6 +130,10 @@ The following is used like: [Required] [Operand(1)] public string Message { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } enum MessageImportanceEnum { diff --git a/docs-generation/Website/www/commands.md b/docs-generation/Website/www/commands.md index dbb4d96..c0eb9ba 100644 --- a/docs-generation/Website/www/commands.md +++ b/docs-generation/Website/www/commands.md @@ -35,6 +35,10 @@ This is the purpose of `BaseCliCommands`. // var arguments = Cli.Parse(args); // ...Application logic } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } #### Attributes diff --git a/docs-generation/Website/www/help_generator.md b/docs-generation/Website/www/help_generator.md index f6c9b52..c3dc6d1 100644 --- a/docs-generation/Website/www/help_generator.md +++ b/docs-generation/Website/www/help_generator.md @@ -29,6 +29,10 @@ The Help Generator consumes the following information for each class type. public void Command1(string[] args) { // ...etc } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } class CommandsHelpProgram { @@ -58,6 +62,10 @@ The Help Generator consumes the following information for each class type. [OptionParameter(LongName: "value1")] [Help("Some value to set")] public bool Value1 { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } class ArgumentsHelpProgram { @@ -98,4 +106,8 @@ Below is a brief example of overriding the help method. Console.WriteLine(helpText); throw new HelpInvokedException("Using an exception to control application flow"); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } diff --git a/docs-generation/Website/www/user_facing_exceptions.md b/docs-generation/Website/www/user_facing_exceptions.md new file mode 100644 index 0000000..c0c9200 --- /dev/null +++ b/docs-generation/Website/www/user_facing_exceptions.md @@ -0,0 +1,102 @@ +## User Facing Exceptions + +When a user makes a mistake, EntryPoint will throw an exception which derives from UserFacingException. + +This exception is caught and the following takes place on the relevant CliCommands or CliArguments instance +* `.UserFacingExceptionThrown` is set to `true` +* the virtual method `.OnUserFacingException(UserFacingException e, string message)` is called + +The virtual method contains a sane default implementation which prints to screen and exits the application. + + +#### Custom OnUserFacingException Handler + +If you want your own implementation you can override this, like so + + + class CliArguments : BaseCliArguments { + public CliArguments() : base("Test") { } + + [Option(LongName: "Option", + ShortName: 'o')] + public bool Option { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + // your own handling of the message for the user + Console.WriteLine("User error: " + message); + } + } + + class UserFacingExceptionProgram { + public void main(string[] args) { + var arguments = Cli.Parse(args); + // Execution would not reach this point if the user provides invalid arguments, + // since OnUserFacingException would run and exit the program + + // However, if you override OnUserFacingException and don't exit, + // you could also do this: + if (arguments.UserFacingExceptionThrown) { + // Return here, or run something else + } + + // Normal Post-Arguments Application code... + } + } + +#### UserFacingException Bubbling + +If your application utilises both CliCommands and CliArguments, +you may want to handle UserFacingExceptions only on the CliCommands level. + +This can be achieved using bubbling. + +Simply override OnUserFacingException in your CliArguments implementations and re-throw the exception. +The exception will then be caught at the CliCommands level. + + + class BubblingCliArguments : BaseCliArguments { + public BubblingCliArguments() : base("Test") { } + + [Option(LongName: "Option", + ShortName: 'o')] + public bool Option { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + // Re-throw the exception, causing it to bubble up to the root command + throw e; + } + } + + class BubblingCliCommands : BaseCliCommands{ + + [Command("command1")] + public void Command1(string[] args) { + var arguments = Cli.Parse(args); + + // Normal Post-Arguments application logic + } + + public override void OnUserFacingException(UserFacingException e, string message) { + // All UserFacingException throws will now come to here + Console.WriteLine("User error: " + message); + Console.ReadLine(); + Environment.Exit(1); + } + } + + class BubblingProgram { + public void main(string[] args) { + var commands = Cli.Execute(args); + // Execution would not reach this point when the user provides invalid + // commands or arguments, since our custom OnUserFacingException handler + // would run and exit the program + + // However, if you override OnUserFacingException and don't exit, + // you could also do this: + if (commands.UserFacingExceptionThrown) { + // Return here, or run something else + } + + // Normal Post-Command Application code... + } + } diff --git a/docs-generation/docfx/api/.manifest b/docs-generation/docfx/api/.manifest index 29c7cd1..cf388d2 100644 --- a/docs-generation/docfx/api/.manifest +++ b/docs-generation/docfx/api/.manifest @@ -1 +1 @@ -{"EntryPoint":"EntryPoint.yml","EntryPoint.BaseCliArguments":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.#ctor(System.String)":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.Operands":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.HelpInvoked":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliCommands":"EntryPoint.BaseCliCommands.yml","EntryPoint.Cli":"EntryPoint.Cli.yml","EntryPoint.Cli.Parse``1":"EntryPoint.Cli.yml","EntryPoint.Cli.Parse``1(System.String[])":"EntryPoint.Cli.yml","EntryPoint.Cli.Parse``1(``0,System.String[])":"EntryPoint.Cli.yml","EntryPoint.Cli.Execute``1":"EntryPoint.Cli.yml","EntryPoint.Cli.Execute``1(System.String[])":"EntryPoint.Cli.yml","EntryPoint.Cli.Execute``1(``0,System.String[])":"EntryPoint.Cli.yml","EntryPoint.Cli.GetHelp``1":"EntryPoint.Cli.yml","EntryPoint.Cli.GetHelp``1(``0)":"EntryPoint.Cli.yml","EntryPoint.CommandAttribute":"EntryPoint.CommandAttribute.yml","EntryPoint.CommandAttribute.#ctor(System.String)":"EntryPoint.CommandAttribute.yml","EntryPoint.DefaultCommandAttribute":"EntryPoint.DefaultCommandAttribute.yml","EntryPoint.DefaultCommandAttribute.#ctor":"EntryPoint.DefaultCommandAttribute.yml","EntryPoint.HelpAttribute":"EntryPoint.HelpAttribute.yml","EntryPoint.HelpAttribute.#ctor(System.String)":"EntryPoint.HelpAttribute.yml","EntryPoint.HelpAttribute.Detail":"EntryPoint.HelpAttribute.yml","EntryPoint.OperandAttribute":"EntryPoint.OperandAttribute.yml","EntryPoint.OperandAttribute.#ctor(System.Int32)":"EntryPoint.OperandAttribute.yml","EntryPoint.OperandAttribute.Position":"EntryPoint.OperandAttribute.yml","EntryPoint.OptionAttribute":"EntryPoint.OptionAttribute.yml","EntryPoint.OptionAttribute.#ctor(System.String,System.Char)":"EntryPoint.OptionAttribute.yml","EntryPoint.OptionAttribute.#ctor(System.String)":"EntryPoint.OptionAttribute.yml","EntryPoint.OptionAttribute.#ctor(System.Char)":"EntryPoint.OptionAttribute.yml","EntryPoint.OptionParameterAttribute":"EntryPoint.OptionParameterAttribute.yml","EntryPoint.OptionParameterAttribute.#ctor(System.String,System.Char)":"EntryPoint.OptionParameterAttribute.yml","EntryPoint.OptionParameterAttribute.#ctor(System.String)":"EntryPoint.OptionParameterAttribute.yml","EntryPoint.OptionParameterAttribute.#ctor(System.Char)":"EntryPoint.OptionParameterAttribute.yml","EntryPoint.RequiredAttribute":"EntryPoint.RequiredAttribute.yml","EntryPoint.Exceptions":"EntryPoint.Exceptions.yml","EntryPoint.Exceptions.DuplicateOptionException":"EntryPoint.Exceptions.DuplicateOptionException.yml","EntryPoint.Exceptions.InvalidModelException":"EntryPoint.Exceptions.InvalidModelException.yml","EntryPoint.Exceptions.NoParameterException":"EntryPoint.Exceptions.NoParameterException.yml","EntryPoint.Exceptions.RequiredException":"EntryPoint.Exceptions.RequiredException.yml","EntryPoint.Exceptions.UnknownOptionException":"EntryPoint.Exceptions.UnknownOptionException.yml","EntryPoint.Exceptions.UserFacingException":"EntryPoint.Exceptions.UserFacingException.yml"} \ No newline at end of file +{"EntryPoint":"EntryPoint.yml","EntryPoint.BaseCliArguments":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.#ctor(System.String)":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.Operands":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.HelpInvoked":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.OnHelpInvoked(System.String)":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.UserFacingExceptionThrown":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.OnUserFacingException(EntryPoint.Exceptions.UserFacingException,System.String)":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliCommands":"EntryPoint.BaseCliCommands.yml","EntryPoint.BaseCliCommands.HelpInvoked":"EntryPoint.BaseCliCommands.yml","EntryPoint.BaseCliCommands.OnHelpInvoked(System.String)":"EntryPoint.BaseCliCommands.yml","EntryPoint.BaseCliCommands.UserFacingExceptionThrown":"EntryPoint.BaseCliCommands.yml","EntryPoint.BaseCliCommands.OnUserFacingException(EntryPoint.Exceptions.UserFacingException,System.String)":"EntryPoint.BaseCliCommands.yml","EntryPoint.Cli":"EntryPoint.Cli.yml","EntryPoint.Cli.Parse``1":"EntryPoint.Cli.yml","EntryPoint.Cli.Parse``1(System.String[])":"EntryPoint.Cli.yml","EntryPoint.Cli.Parse``1(``0,System.String[])":"EntryPoint.Cli.yml","EntryPoint.Cli.Execute``1":"EntryPoint.Cli.yml","EntryPoint.Cli.Execute``1(System.String[])":"EntryPoint.Cli.yml","EntryPoint.Cli.Execute``1(``0,System.String[])":"EntryPoint.Cli.yml","EntryPoint.Cli.GetHelp``1":"EntryPoint.Cli.yml","EntryPoint.Cli.GetHelp``1(``0)":"EntryPoint.Cli.yml","EntryPoint.CommandAttribute":"EntryPoint.CommandAttribute.yml","EntryPoint.CommandAttribute.#ctor(System.String)":"EntryPoint.CommandAttribute.yml","EntryPoint.DefaultCommandAttribute":"EntryPoint.DefaultCommandAttribute.yml","EntryPoint.DefaultCommandAttribute.#ctor":"EntryPoint.DefaultCommandAttribute.yml","EntryPoint.HelpAttribute":"EntryPoint.HelpAttribute.yml","EntryPoint.HelpAttribute.#ctor(System.String)":"EntryPoint.HelpAttribute.yml","EntryPoint.HelpAttribute.Detail":"EntryPoint.HelpAttribute.yml","EntryPoint.OperandAttribute":"EntryPoint.OperandAttribute.yml","EntryPoint.OperandAttribute.#ctor(System.Int32)":"EntryPoint.OperandAttribute.yml","EntryPoint.OperandAttribute.Position":"EntryPoint.OperandAttribute.yml","EntryPoint.OptionAttribute":"EntryPoint.OptionAttribute.yml","EntryPoint.OptionAttribute.#ctor(System.String,System.Char)":"EntryPoint.OptionAttribute.yml","EntryPoint.OptionAttribute.#ctor(System.String)":"EntryPoint.OptionAttribute.yml","EntryPoint.OptionAttribute.#ctor(System.Char)":"EntryPoint.OptionAttribute.yml","EntryPoint.OptionParameterAttribute":"EntryPoint.OptionParameterAttribute.yml","EntryPoint.OptionParameterAttribute.#ctor(System.String,System.Char)":"EntryPoint.OptionParameterAttribute.yml","EntryPoint.OptionParameterAttribute.#ctor(System.String)":"EntryPoint.OptionParameterAttribute.yml","EntryPoint.OptionParameterAttribute.#ctor(System.Char)":"EntryPoint.OptionParameterAttribute.yml","EntryPoint.RequiredAttribute":"EntryPoint.RequiredAttribute.yml","EntryPoint.Exceptions":"EntryPoint.Exceptions.yml","EntryPoint.Exceptions.DuplicateOptionException":"EntryPoint.Exceptions.DuplicateOptionException.yml","EntryPoint.Exceptions.InvalidModelException":"EntryPoint.Exceptions.InvalidModelException.yml","EntryPoint.Exceptions.NoParameterException":"EntryPoint.Exceptions.NoParameterException.yml","EntryPoint.Exceptions.RequiredException":"EntryPoint.Exceptions.RequiredException.yml","EntryPoint.Exceptions.UnknownOptionException":"EntryPoint.Exceptions.UnknownOptionException.yml","EntryPoint.Exceptions.UserFacingException":"EntryPoint.Exceptions.UserFacingException.yml"} \ No newline at end of file diff --git a/docs-generation/docfx/articles/arguments.md b/docs-generation/docfx/articles/arguments.md index 85c6216..fade945 100644 --- a/docs-generation/docfx/articles/arguments.md +++ b/docs-generation/docfx/articles/arguments.md @@ -42,6 +42,10 @@ This has one Option `-s`, one OptionParameter `--name Bob` and a positional Oper // un-mapped operands are stored [Operand(Position: 1)] public decimal FirstOperand { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } #### Attributes @@ -126,6 +130,10 @@ The following is used like: [Required] [Operand(1)] public string Message { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } enum MessageImportanceEnum { diff --git a/docs-generation/docfx/articles/commands.md b/docs-generation/docfx/articles/commands.md index dbb4d96..c0eb9ba 100644 --- a/docs-generation/docfx/articles/commands.md +++ b/docs-generation/docfx/articles/commands.md @@ -35,6 +35,10 @@ This is the purpose of `BaseCliCommands`. // var arguments = Cli.Parse(args); // ...Application logic } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } #### Attributes diff --git a/docs-generation/docfx/articles/help_generator.md b/docs-generation/docfx/articles/help_generator.md index f6c9b52..c3dc6d1 100644 --- a/docs-generation/docfx/articles/help_generator.md +++ b/docs-generation/docfx/articles/help_generator.md @@ -29,6 +29,10 @@ The Help Generator consumes the following information for each class type. public void Command1(string[] args) { // ...etc } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } class CommandsHelpProgram { @@ -58,6 +62,10 @@ The Help Generator consumes the following information for each class type. [OptionParameter(LongName: "value1")] [Help("Some value to set")] public bool Value1 { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } class ArgumentsHelpProgram { @@ -98,4 +106,8 @@ Below is a brief example of overriding the help method. Console.WriteLine(helpText); throw new HelpInvokedException("Using an exception to control application flow"); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } diff --git a/docs-generation/docfx/articles/toc.yml b/docs-generation/docfx/articles/toc.yml index d2303c9..5cc34a9 100644 --- a/docs-generation/docfx/articles/toc.yml +++ b/docs-generation/docfx/articles/toc.yml @@ -8,5 +8,7 @@ href: commands.md - name: Help Generator href: help_generator.md +- name: Invalid Argument Handling + href: user_facing_exceptions.md - name: Tips & Behaviour href: tips.md diff --git a/docs-generation/docfx/articles/user_facing_exceptions.md b/docs-generation/docfx/articles/user_facing_exceptions.md new file mode 100644 index 0000000..c0c9200 --- /dev/null +++ b/docs-generation/docfx/articles/user_facing_exceptions.md @@ -0,0 +1,102 @@ +## User Facing Exceptions + +When a user makes a mistake, EntryPoint will throw an exception which derives from UserFacingException. + +This exception is caught and the following takes place on the relevant CliCommands or CliArguments instance +* `.UserFacingExceptionThrown` is set to `true` +* the virtual method `.OnUserFacingException(UserFacingException e, string message)` is called + +The virtual method contains a sane default implementation which prints to screen and exits the application. + + +#### Custom OnUserFacingException Handler + +If you want your own implementation you can override this, like so + + + class CliArguments : BaseCliArguments { + public CliArguments() : base("Test") { } + + [Option(LongName: "Option", + ShortName: 'o')] + public bool Option { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + // your own handling of the message for the user + Console.WriteLine("User error: " + message); + } + } + + class UserFacingExceptionProgram { + public void main(string[] args) { + var arguments = Cli.Parse(args); + // Execution would not reach this point if the user provides invalid arguments, + // since OnUserFacingException would run and exit the program + + // However, if you override OnUserFacingException and don't exit, + // you could also do this: + if (arguments.UserFacingExceptionThrown) { + // Return here, or run something else + } + + // Normal Post-Arguments Application code... + } + } + +#### UserFacingException Bubbling + +If your application utilises both CliCommands and CliArguments, +you may want to handle UserFacingExceptions only on the CliCommands level. + +This can be achieved using bubbling. + +Simply override OnUserFacingException in your CliArguments implementations and re-throw the exception. +The exception will then be caught at the CliCommands level. + + + class BubblingCliArguments : BaseCliArguments { + public BubblingCliArguments() : base("Test") { } + + [Option(LongName: "Option", + ShortName: 'o')] + public bool Option { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + // Re-throw the exception, causing it to bubble up to the root command + throw e; + } + } + + class BubblingCliCommands : BaseCliCommands{ + + [Command("command1")] + public void Command1(string[] args) { + var arguments = Cli.Parse(args); + + // Normal Post-Arguments application logic + } + + public override void OnUserFacingException(UserFacingException e, string message) { + // All UserFacingException throws will now come to here + Console.WriteLine("User error: " + message); + Console.ReadLine(); + Environment.Exit(1); + } + } + + class BubblingProgram { + public void main(string[] args) { + var commands = Cli.Execute(args); + // Execution would not reach this point when the user provides invalid + // commands or arguments, since our custom OnUserFacingException handler + // would run and exit the program + + // However, if you override OnUserFacingException and don't exit, + // you could also do this: + if (commands.UserFacingExceptionThrown) { + // Return here, or run something else + } + + // Normal Post-Command Application code... + } + } From 20771cf677574e27bbb3d928cda72ec5228667e6 Mon Sep 17 00:00:00 2001 From: Nick Lucas Date: Sun, 12 Feb 2017 18:17:39 +0000 Subject: [PATCH 10/13] Expose interfaces so their documentation is available --- docs-generation/docfx/api/.manifest | 2 +- docs-generation/docfx/docfx.json | 3 ++- .../Exceptions/IUserFacingExceptionHandler.cs | 13 ++++++++++++- src/EntryPoint/Help/IHelpable.cs | 6 +++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/docs-generation/docfx/api/.manifest b/docs-generation/docfx/api/.manifest index cf388d2..0abfb5b 100644 --- a/docs-generation/docfx/api/.manifest +++ b/docs-generation/docfx/api/.manifest @@ -1 +1 @@ -{"EntryPoint":"EntryPoint.yml","EntryPoint.BaseCliArguments":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.#ctor(System.String)":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.Operands":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.HelpInvoked":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.OnHelpInvoked(System.String)":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.UserFacingExceptionThrown":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.OnUserFacingException(EntryPoint.Exceptions.UserFacingException,System.String)":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliCommands":"EntryPoint.BaseCliCommands.yml","EntryPoint.BaseCliCommands.HelpInvoked":"EntryPoint.BaseCliCommands.yml","EntryPoint.BaseCliCommands.OnHelpInvoked(System.String)":"EntryPoint.BaseCliCommands.yml","EntryPoint.BaseCliCommands.UserFacingExceptionThrown":"EntryPoint.BaseCliCommands.yml","EntryPoint.BaseCliCommands.OnUserFacingException(EntryPoint.Exceptions.UserFacingException,System.String)":"EntryPoint.BaseCliCommands.yml","EntryPoint.Cli":"EntryPoint.Cli.yml","EntryPoint.Cli.Parse``1":"EntryPoint.Cli.yml","EntryPoint.Cli.Parse``1(System.String[])":"EntryPoint.Cli.yml","EntryPoint.Cli.Parse``1(``0,System.String[])":"EntryPoint.Cli.yml","EntryPoint.Cli.Execute``1":"EntryPoint.Cli.yml","EntryPoint.Cli.Execute``1(System.String[])":"EntryPoint.Cli.yml","EntryPoint.Cli.Execute``1(``0,System.String[])":"EntryPoint.Cli.yml","EntryPoint.Cli.GetHelp``1":"EntryPoint.Cli.yml","EntryPoint.Cli.GetHelp``1(``0)":"EntryPoint.Cli.yml","EntryPoint.CommandAttribute":"EntryPoint.CommandAttribute.yml","EntryPoint.CommandAttribute.#ctor(System.String)":"EntryPoint.CommandAttribute.yml","EntryPoint.DefaultCommandAttribute":"EntryPoint.DefaultCommandAttribute.yml","EntryPoint.DefaultCommandAttribute.#ctor":"EntryPoint.DefaultCommandAttribute.yml","EntryPoint.HelpAttribute":"EntryPoint.HelpAttribute.yml","EntryPoint.HelpAttribute.#ctor(System.String)":"EntryPoint.HelpAttribute.yml","EntryPoint.HelpAttribute.Detail":"EntryPoint.HelpAttribute.yml","EntryPoint.OperandAttribute":"EntryPoint.OperandAttribute.yml","EntryPoint.OperandAttribute.#ctor(System.Int32)":"EntryPoint.OperandAttribute.yml","EntryPoint.OperandAttribute.Position":"EntryPoint.OperandAttribute.yml","EntryPoint.OptionAttribute":"EntryPoint.OptionAttribute.yml","EntryPoint.OptionAttribute.#ctor(System.String,System.Char)":"EntryPoint.OptionAttribute.yml","EntryPoint.OptionAttribute.#ctor(System.String)":"EntryPoint.OptionAttribute.yml","EntryPoint.OptionAttribute.#ctor(System.Char)":"EntryPoint.OptionAttribute.yml","EntryPoint.OptionParameterAttribute":"EntryPoint.OptionParameterAttribute.yml","EntryPoint.OptionParameterAttribute.#ctor(System.String,System.Char)":"EntryPoint.OptionParameterAttribute.yml","EntryPoint.OptionParameterAttribute.#ctor(System.String)":"EntryPoint.OptionParameterAttribute.yml","EntryPoint.OptionParameterAttribute.#ctor(System.Char)":"EntryPoint.OptionParameterAttribute.yml","EntryPoint.RequiredAttribute":"EntryPoint.RequiredAttribute.yml","EntryPoint.Exceptions":"EntryPoint.Exceptions.yml","EntryPoint.Exceptions.DuplicateOptionException":"EntryPoint.Exceptions.DuplicateOptionException.yml","EntryPoint.Exceptions.InvalidModelException":"EntryPoint.Exceptions.InvalidModelException.yml","EntryPoint.Exceptions.NoParameterException":"EntryPoint.Exceptions.NoParameterException.yml","EntryPoint.Exceptions.RequiredException":"EntryPoint.Exceptions.RequiredException.yml","EntryPoint.Exceptions.UnknownOptionException":"EntryPoint.Exceptions.UnknownOptionException.yml","EntryPoint.Exceptions.UserFacingException":"EntryPoint.Exceptions.UserFacingException.yml"} \ No newline at end of file +{"EntryPoint":"EntryPoint.yml","EntryPoint.BaseCliArguments":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.#ctor(System.String)":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.Operands":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.HelpInvoked":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.OnHelpInvoked(System.String)":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.UserFacingExceptionThrown":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliArguments.OnUserFacingException(EntryPoint.Exceptions.UserFacingException,System.String)":"EntryPoint.BaseCliArguments.yml","EntryPoint.BaseCliCommands":"EntryPoint.BaseCliCommands.yml","EntryPoint.BaseCliCommands.HelpInvoked":"EntryPoint.BaseCliCommands.yml","EntryPoint.BaseCliCommands.OnHelpInvoked(System.String)":"EntryPoint.BaseCliCommands.yml","EntryPoint.BaseCliCommands.UserFacingExceptionThrown":"EntryPoint.BaseCliCommands.yml","EntryPoint.BaseCliCommands.OnUserFacingException(EntryPoint.Exceptions.UserFacingException,System.String)":"EntryPoint.BaseCliCommands.yml","EntryPoint.Cli":"EntryPoint.Cli.yml","EntryPoint.Cli.Parse``1":"EntryPoint.Cli.yml","EntryPoint.Cli.Parse``1(System.String[])":"EntryPoint.Cli.yml","EntryPoint.Cli.Parse``1(``0,System.String[])":"EntryPoint.Cli.yml","EntryPoint.Cli.Execute``1":"EntryPoint.Cli.yml","EntryPoint.Cli.Execute``1(System.String[])":"EntryPoint.Cli.yml","EntryPoint.Cli.Execute``1(``0,System.String[])":"EntryPoint.Cli.yml","EntryPoint.Cli.GetHelp``1":"EntryPoint.Cli.yml","EntryPoint.Cli.GetHelp``1(``0)":"EntryPoint.Cli.yml","EntryPoint.CommandAttribute":"EntryPoint.CommandAttribute.yml","EntryPoint.CommandAttribute.#ctor(System.String)":"EntryPoint.CommandAttribute.yml","EntryPoint.DefaultCommandAttribute":"EntryPoint.DefaultCommandAttribute.yml","EntryPoint.DefaultCommandAttribute.#ctor":"EntryPoint.DefaultCommandAttribute.yml","EntryPoint.HelpAttribute":"EntryPoint.HelpAttribute.yml","EntryPoint.HelpAttribute.#ctor(System.String)":"EntryPoint.HelpAttribute.yml","EntryPoint.HelpAttribute.Detail":"EntryPoint.HelpAttribute.yml","EntryPoint.OperandAttribute":"EntryPoint.OperandAttribute.yml","EntryPoint.OperandAttribute.#ctor(System.Int32)":"EntryPoint.OperandAttribute.yml","EntryPoint.OperandAttribute.Position":"EntryPoint.OperandAttribute.yml","EntryPoint.OptionAttribute":"EntryPoint.OptionAttribute.yml","EntryPoint.OptionAttribute.#ctor(System.String,System.Char)":"EntryPoint.OptionAttribute.yml","EntryPoint.OptionAttribute.#ctor(System.String)":"EntryPoint.OptionAttribute.yml","EntryPoint.OptionAttribute.#ctor(System.Char)":"EntryPoint.OptionAttribute.yml","EntryPoint.OptionParameterAttribute":"EntryPoint.OptionParameterAttribute.yml","EntryPoint.OptionParameterAttribute.#ctor(System.String,System.Char)":"EntryPoint.OptionParameterAttribute.yml","EntryPoint.OptionParameterAttribute.#ctor(System.String)":"EntryPoint.OptionParameterAttribute.yml","EntryPoint.OptionParameterAttribute.#ctor(System.Char)":"EntryPoint.OptionParameterAttribute.yml","EntryPoint.RequiredAttribute":"EntryPoint.RequiredAttribute.yml","EntryPoint.Exceptions":"EntryPoint.Exceptions.yml","EntryPoint.Exceptions.DuplicateOptionException":"EntryPoint.Exceptions.DuplicateOptionException.yml","EntryPoint.Exceptions.InvalidModelException":"EntryPoint.Exceptions.InvalidModelException.yml","EntryPoint.Exceptions.IUserFacingExceptionHandler":"EntryPoint.Exceptions.IUserFacingExceptionHandler.yml","EntryPoint.Exceptions.IUserFacingExceptionHandler.UserFacingExceptionThrown":"EntryPoint.Exceptions.IUserFacingExceptionHandler.yml","EntryPoint.Exceptions.IUserFacingExceptionHandler.OnUserFacingException(EntryPoint.Exceptions.UserFacingException,System.String)":"EntryPoint.Exceptions.IUserFacingExceptionHandler.yml","EntryPoint.Exceptions.NoParameterException":"EntryPoint.Exceptions.NoParameterException.yml","EntryPoint.Exceptions.RequiredException":"EntryPoint.Exceptions.RequiredException.yml","EntryPoint.Exceptions.UnknownOptionException":"EntryPoint.Exceptions.UnknownOptionException.yml","EntryPoint.Exceptions.UserFacingException":"EntryPoint.Exceptions.UserFacingException.yml","EntryPoint.Help":"EntryPoint.Help.yml","EntryPoint.Help.IHelpable":"EntryPoint.Help.IHelpable.yml","EntryPoint.Help.IHelpable.HelpInvoked":"EntryPoint.Help.IHelpable.yml","EntryPoint.Help.IHelpable.OnHelpInvoked(System.String)":"EntryPoint.Help.IHelpable.yml"} \ No newline at end of file diff --git a/docs-generation/docfx/docfx.json b/docs-generation/docfx/docfx.json index fe6c561..810c8ec 100644 --- a/docs-generation/docfx/docfx.json +++ b/docs-generation/docfx/docfx.json @@ -5,7 +5,8 @@ { "files": [ "src/EntryPoint/*.cs", - "src/EntryPoint/Exceptions/*.cs" + "src/EntryPoint/Exceptions/*.cs", + "src/EntryPoint/Help/*.cs" ], "exclude": [ "**/obj/**", diff --git a/src/EntryPoint/Exceptions/IUserFacingExceptionHandler.cs b/src/EntryPoint/Exceptions/IUserFacingExceptionHandler.cs index b2d2c7f..12660a2 100644 --- a/src/EntryPoint/Exceptions/IUserFacingExceptionHandler.cs +++ b/src/EntryPoint/Exceptions/IUserFacingExceptionHandler.cs @@ -4,8 +4,19 @@ using System.Threading.Tasks; namespace EntryPoint.Exceptions { - interface IUserFacingExceptionHandler { + public interface IUserFacingExceptionHandler { + + /// + /// Set True whenever a UserFacingException bubbles up and is handled by the instance implementing this interface + /// bool UserFacingExceptionThrown { get; set; } + + /// + /// Called whenever a UserFacingException bubbles up and is handled by the instance implementing this interface + /// + /// thrown exception + /// a message to display to the user void OnUserFacingException(UserFacingException e, string message); + } } diff --git a/src/EntryPoint/Help/IHelpable.cs b/src/EntryPoint/Help/IHelpable.cs index 995ee2f..13053ae 100644 --- a/src/EntryPoint/Help/IHelpable.cs +++ b/src/EntryPoint/Help/IHelpable.cs @@ -6,7 +6,10 @@ namespace EntryPoint.Help { public interface IHelpable { - // Set when the user invokes -h/--help + + /// + /// Set when the user invokes -h/--help + /// bool HelpInvoked { get; set; } /// @@ -14,5 +17,6 @@ public interface IHelpable { /// /// The help string for this class void OnHelpInvoked(string helpText); + } } From c91c2f14ff4fe274aaa51f0a477177e1e29921f7 Mon Sep 17 00:00:00 2001 From: Nick Lucas Date: Sun, 12 Feb 2017 18:26:49 +0000 Subject: [PATCH 11/13] DRY out the default handling for UserFacingException --- src/EntryPoint/BaseCliArguments.cs | 5 +---- src/EntryPoint/BaseCliCommands.cs | 5 +---- .../Exceptions/UserFacingExceptionDefaults.cs | 21 +++++++++++++++++++ 3 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 src/EntryPoint/Exceptions/UserFacingExceptionDefaults.cs diff --git a/src/EntryPoint/BaseCliArguments.cs b/src/EntryPoint/BaseCliArguments.cs index 4cc4e9a..519af45 100644 --- a/src/EntryPoint/BaseCliArguments.cs +++ b/src/EntryPoint/BaseCliArguments.cs @@ -53,10 +53,7 @@ public abstract class BaseCliArguments : IHelpable, IUserFacingExceptionHandler public bool UserFacingExceptionThrown { get; set; } public virtual void OnUserFacingException(UserFacingException e, string message) { - Console.WriteLine(message); - Console.WriteLine("Press enter to exit..."); - Console.ReadLine(); - Environment.Exit(1); + UserFacingExceptionDefaults.OnUserFacingException(e, message); } } diff --git a/src/EntryPoint/BaseCliCommands.cs b/src/EntryPoint/BaseCliCommands.cs index e88b8f1..509e706 100644 --- a/src/EntryPoint/BaseCliCommands.cs +++ b/src/EntryPoint/BaseCliCommands.cs @@ -32,10 +32,7 @@ public abstract class BaseCliCommands : IHelpable, IUserFacingExceptionHandler { public bool UserFacingExceptionThrown { get; set; } public virtual void OnUserFacingException(UserFacingException e, string message) { - Console.WriteLine(message); - Console.WriteLine("Press enter to exit..."); - Console.ReadLine(); - Environment.Exit(1); + UserFacingExceptionDefaults.OnUserFacingException(e, message); } } diff --git a/src/EntryPoint/Exceptions/UserFacingExceptionDefaults.cs b/src/EntryPoint/Exceptions/UserFacingExceptionDefaults.cs new file mode 100644 index 0000000..831a485 --- /dev/null +++ b/src/EntryPoint/Exceptions/UserFacingExceptionDefaults.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EntryPoint.Exceptions { + internal static class UserFacingExceptionDefaults { + public static void OnUserFacingException(UserFacingException e, string message) { + Console.WriteLine(); + + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine("Arguments Error: "); + Console.WriteLine(message); + Console.ResetColor(); + + Console.WriteLine("Press enter to exit..."); + Console.ReadLine(); + Environment.Exit(1); + } + } +} From 5efbc622cc17d9ecccbb0013606edc27b2ced9bf Mon Sep 17 00:00:00 2001 From: Nick Lucas Date: Sun, 12 Feb 2017 18:31:09 +0000 Subject: [PATCH 12/13] Deploy webite --- docs/api/EntryPoint.BaseCliArguments.html | 143 ++++++++++++- docs/api/EntryPoint.BaseCliCommands.html | 168 ++++++++++++++- docs/api/EntryPoint.Cli.html | 22 +- docs/api/EntryPoint.CommandAttribute.html | 4 +- .../EntryPoint.DefaultCommandAttribute.html | 4 +- ...t.Exceptions.DuplicateOptionException.html | 2 +- ...xceptions.IUserFacingExceptionHandler.html | 198 +++++++++++++++++ ...oint.Exceptions.InvalidModelException.html | 2 +- ...Point.Exceptions.NoParameterException.html | 2 +- ...tryPoint.Exceptions.RequiredException.html | 2 +- ...int.Exceptions.UnknownOptionException.html | 2 +- ...yPoint.Exceptions.UserFacingException.html | 2 +- docs/api/EntryPoint.Exceptions.html | 6 +- docs/api/EntryPoint.Help.IHelpable.html | 192 +++++++++++++++++ docs/api/EntryPoint.Help.html | 122 +++++++++++ docs/api/EntryPoint.HelpAttribute.html | 6 +- docs/api/EntryPoint.OperandAttribute.html | 6 +- docs/api/EntryPoint.OptionAttribute.html | 8 +- .../EntryPoint.OptionParameterAttribute.html | 8 +- docs/api/EntryPoint.RequiredAttribute.html | 2 +- docs/api/EntryPoint.html | 2 +- docs/api/index.html | 2 +- docs/api/toc.html | 24 +++ docs/articles/api_overview.html | 2 +- docs/articles/arguments.html | 10 +- docs/articles/commands.html | 6 +- docs/articles/help_generator.html | 14 +- docs/articles/intro.html | 2 +- docs/articles/tips.html | 2 +- docs/articles/toc.html | 6 + docs/articles/user_facing_exceptions.html | 202 ++++++++++++++++++ docs/index.html | 2 +- docs/manifest.json | 2 +- docs/xrefmap.yml | 150 +++++++++++++ 34 files changed, 1271 insertions(+), 56 deletions(-) create mode 100644 docs/api/EntryPoint.Exceptions.IUserFacingExceptionHandler.html create mode 100644 docs/api/EntryPoint.Help.IHelpable.html create mode 100644 docs/api/EntryPoint.Help.html create mode 100644 docs/articles/user_facing_exceptions.html diff --git a/docs/api/EntryPoint.BaseCliArguments.html b/docs/api/EntryPoint.BaseCliArguments.html index f8de2ba..b30c9dc 100644 --- a/docs/api/EntryPoint.BaseCliArguments.html +++ b/docs/api/EntryPoint.BaseCliArguments.html @@ -83,18 +83,43 @@
Inheritance
System.Object
BaseCliArguments
- +
Syntax
-
public abstract class BaseCliArguments : BaseHelpable
+
public abstract class BaseCliArguments : IHelpable, IUserFacingExceptionHandler

Constructors

| -
Improve this Doc + Improve this Doc @@ -129,7 +154,7 @@

Properties

| - Improve this Doc + Improve this Doc @@ -157,9 +182,11 @@
Property Value
+
Implements
+
IHelpable.HelpInvoked
| - Improve this Doc + Improve this Doc @@ -187,6 +214,110 @@
Property Value
+ + | + Improve this Doc + + + +

UserFacingExceptionThrown

+
+
+
Declaration
+
+
public bool UserFacingExceptionThrown { get; set; }
+
+ +
Property Value
+ + + + + + + + + + + + + +
TypeDescription
System.Boolean
+
Implements
+
IUserFacingExceptionHandler.UserFacingExceptionThrown
+

Methods +

+ + | + Improve this Doc + + + +

OnHelpInvoked(String)

+
+
+
Declaration
+
+
public virtual void OnHelpInvoked(string helpText)
+
+
Parameters
+ + + + + + + + + + + + + + + +
TypeNameDescription
System.StringhelpText
+ +
Implements
+
IHelpable.OnHelpInvoked(String)
+ + | + Improve this Doc + + + +

OnUserFacingException(UserFacingException, String)

+
+
+
Declaration
+
+
public virtual void OnUserFacingException(UserFacingException e, string message)
+
+
Parameters
+ + + + + + + + + + + + + + + + + + + + +
TypeNameDescription
UserFacingExceptione
System.Stringmessage
+ +
Implements
+
IUserFacingExceptionHandler.OnUserFacingException(UserFacingException, String)
@@ -195,7 +326,7 @@
Property Value
diff --git a/docs/api/EntryPoint.BaseCliCommands.html b/docs/api/EntryPoint.BaseCliCommands.html index 3ad5d46..2678200 100644 --- a/docs/api/EntryPoint.BaseCliCommands.html +++ b/docs/api/EntryPoint.BaseCliCommands.html @@ -83,13 +83,175 @@
Inheritance
System.Object
BaseCliCommands
- +
Syntax
-
public abstract class BaseCliCommands : BaseHelpable
+
public abstract class BaseCliCommands : IHelpable, IUserFacingExceptionHandler
+
+

Properties +

+ + | + Improve this Doc + + + +

HelpInvoked

+
+
+
Declaration
+
+
public bool HelpInvoked { get; set; }
+ +
Property Value
+ + + + + + + + + + + + + +
TypeDescription
System.Boolean
+
Implements
+
IHelpable.HelpInvoked
+ + | + Improve this Doc + + + +

UserFacingExceptionThrown

+
+
+
Declaration
+
+
public bool UserFacingExceptionThrown { get; set; }
+
+ +
Property Value
+ + + + + + + + + + + + + +
TypeDescription
System.Boolean
+
Implements
+
IUserFacingExceptionHandler.UserFacingExceptionThrown
+

Methods +

+ + | + Improve this Doc + + + +

OnHelpInvoked(String)

+
+
+
Declaration
+
+
public virtual void OnHelpInvoked(string helpText)
+
+
Parameters
+ + + + + + + + + + + + + + + +
TypeNameDescription
System.StringhelpText
+ +
Implements
+
IHelpable.OnHelpInvoked(String)
+ + | + Improve this Doc + + + +

OnUserFacingException(UserFacingException, String)

+
+
+
Declaration
+
+
public virtual void OnUserFacingException(UserFacingException e, string message)
+
+
Parameters
+ + + + + + + + + + + + + + + + + + + + +
TypeNameDescription
UserFacingExceptione
System.Stringmessage
+ +
Implements
+
IUserFacingExceptionHandler.OnUserFacingException(UserFacingException, String)
@@ -98,7 +260,7 @@
Syntax
diff --git a/docs/api/EntryPoint.Cli.html b/docs/api/EntryPoint.Cli.html index a0de12a..5c75f7c 100644 --- a/docs/api/EntryPoint.Cli.html +++ b/docs/api/EntryPoint.Cli.html @@ -119,7 +119,7 @@

Methods

| - Improve this Doc + Improve this Doc @@ -165,7 +165,7 @@
Type Parameters
| - Improve this Doc + Improve this Doc @@ -235,7 +235,7 @@
Type Parameters
| - Improve this Doc + Improve this Doc @@ -299,7 +299,7 @@
Type Parameters
| - Improve this Doc + Improve this Doc @@ -309,7 +309,7 @@

GetHelp&

Declaration
-
public static string GetHelp<A>()where A : BaseHelpable, new ()
+
public static string GetHelp<A>()where A : IHelpable, new ()
+ + + + + + Interface IUserFacingExceptionHandler + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ + +
+ +
+
+ + + + + + diff --git a/docs/api/EntryPoint.Exceptions.InvalidModelException.html b/docs/api/EntryPoint.Exceptions.InvalidModelException.html index 47a5395..042abbf 100644 --- a/docs/api/EntryPoint.Exceptions.InvalidModelException.html +++ b/docs/api/EntryPoint.Exceptions.InvalidModelException.html @@ -157,7 +157,7 @@
Syntax
diff --git a/docs/api/EntryPoint.Exceptions.NoParameterException.html b/docs/api/EntryPoint.Exceptions.NoParameterException.html index b8427fc..446ea04 100644 --- a/docs/api/EntryPoint.Exceptions.NoParameterException.html +++ b/docs/api/EntryPoint.Exceptions.NoParameterException.html @@ -163,7 +163,7 @@
Syntax
diff --git a/docs/api/EntryPoint.Exceptions.RequiredException.html b/docs/api/EntryPoint.Exceptions.RequiredException.html index 7f96e50..0aa07fa 100644 --- a/docs/api/EntryPoint.Exceptions.RequiredException.html +++ b/docs/api/EntryPoint.Exceptions.RequiredException.html @@ -163,7 +163,7 @@
Syntax
diff --git a/docs/api/EntryPoint.Exceptions.UnknownOptionException.html b/docs/api/EntryPoint.Exceptions.UnknownOptionException.html index b4fe22c..2dff1bd 100644 --- a/docs/api/EntryPoint.Exceptions.UnknownOptionException.html +++ b/docs/api/EntryPoint.Exceptions.UnknownOptionException.html @@ -163,7 +163,7 @@
Syntax
diff --git a/docs/api/EntryPoint.Exceptions.UserFacingException.html b/docs/api/EntryPoint.Exceptions.UserFacingException.html index 066dd61..883a5e0 100644 --- a/docs/api/EntryPoint.Exceptions.UserFacingException.html +++ b/docs/api/EntryPoint.Exceptions.UserFacingException.html @@ -166,7 +166,7 @@
Syntax
diff --git a/docs/api/EntryPoint.Exceptions.html b/docs/api/EntryPoint.Exceptions.html index 53ee981..3e209cc 100644 --- a/docs/api/EntryPoint.Exceptions.html +++ b/docs/api/EntryPoint.Exceptions.html @@ -97,6 +97,10 @@

Unk

UserFacingException

The base exception used for all exceptions caused by the user: incorrect syntax or other argument mistakes

+

Interfaces +

+

IUserFacingExceptionHandler

+
@@ -105,7 +109,7 @@

UserFa diff --git a/docs/api/EntryPoint.Help.IHelpable.html b/docs/api/EntryPoint.Help.IHelpable.html new file mode 100644 index 0000000..1a48fe6 --- /dev/null +++ b/docs/api/EntryPoint.Help.IHelpable.html @@ -0,0 +1,192 @@ + + + + + + + + Interface IHelpable + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ + +
+ +
+
+ + + + + + diff --git a/docs/api/EntryPoint.Help.html b/docs/api/EntryPoint.Help.html new file mode 100644 index 0000000..9b382de --- /dev/null +++ b/docs/api/EntryPoint.Help.html @@ -0,0 +1,122 @@ + + + + + + + + Namespace EntryPoint.Help + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ + +
+ +
+
+ + + + + + diff --git a/docs/api/EntryPoint.HelpAttribute.html b/docs/api/EntryPoint.HelpAttribute.html index 235c000..b41448a 100644 --- a/docs/api/EntryPoint.HelpAttribute.html +++ b/docs/api/EntryPoint.HelpAttribute.html @@ -241,7 +241,7 @@

Constructors

| - Improve this Doc + Improve this Doc @@ -276,7 +276,7 @@

Properties

| - Improve this Doc + Improve this Doc @@ -312,7 +312,7 @@
Property Value
diff --git a/docs/api/EntryPoint.OperandAttribute.html b/docs/api/EntryPoint.OperandAttribute.html index 49e3cb5..fb56816 100644 --- a/docs/api/EntryPoint.OperandAttribute.html +++ b/docs/api/EntryPoint.OperandAttribute.html @@ -238,7 +238,7 @@

Constructors

| - Improve this Doc + Improve this Doc @@ -273,7 +273,7 @@

Properties

| - Improve this Doc + Improve this Doc @@ -309,7 +309,7 @@
Property Value
diff --git a/docs/api/EntryPoint.OptionAttribute.html b/docs/api/EntryPoint.OptionAttribute.html index a6cabf1..7e48a7f 100644 --- a/docs/api/EntryPoint.OptionAttribute.html +++ b/docs/api/EntryPoint.OptionAttribute.html @@ -95,7 +95,7 @@

Constructors

| - Improve this Doc + Improve this Doc @@ -128,7 +128,7 @@
Parameters
| - Improve this Doc + Improve this Doc @@ -161,7 +161,7 @@
Parameters
| - Improve this Doc + Improve this Doc @@ -206,7 +206,7 @@
Parameters
diff --git a/docs/api/EntryPoint.OptionParameterAttribute.html b/docs/api/EntryPoint.OptionParameterAttribute.html index 2481f0b..3144b9f 100644 --- a/docs/api/EntryPoint.OptionParameterAttribute.html +++ b/docs/api/EntryPoint.OptionParameterAttribute.html @@ -95,7 +95,7 @@

Constructors

| - Improve this Doc + Improve this Doc @@ -128,7 +128,7 @@
Parameters
| - Improve this Doc + Improve this Doc @@ -161,7 +161,7 @@
Parameters
| - Improve this Doc + Improve this Doc @@ -206,7 +206,7 @@
Parameters
diff --git a/docs/api/EntryPoint.RequiredAttribute.html b/docs/api/EntryPoint.RequiredAttribute.html index 106ceee..1e40e6e 100644 --- a/docs/api/EntryPoint.RequiredAttribute.html +++ b/docs/api/EntryPoint.RequiredAttribute.html @@ -242,7 +242,7 @@
Syntax
diff --git a/docs/api/EntryPoint.html b/docs/api/EntryPoint.html index 9359322..a433a2d 100644 --- a/docs/api/EntryPoint.html +++ b/docs/api/EntryPoint.html @@ -120,7 +120,7 @@

RequiredAttribute diff --git a/docs/api/index.html b/docs/api/index.html index 741a73c..3f9367e 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -79,7 +79,7 @@ diff --git a/docs/api/toc.html b/docs/api/toc.html index 26fce59..eff3aaa 100644 --- a/docs/api/toc.html +++ b/docs/api/toc.html @@ -87,6 +87,9 @@
  • InvalidModelException
  • +
  • + IUserFacingExceptionHandler +
  • NoParameterException
  • @@ -100,6 +103,15 @@ UserFacingException +
  • + + EntryPoint.Help + +
  • @@ -157,6 +169,9 @@
  • InvalidModelException
  • +
  • + IUserFacingExceptionHandler +
  • NoParameterException
  • @@ -170,6 +185,15 @@ UserFacingException +
  • + + EntryPoint.Help + +
  • diff --git a/docs/articles/api_overview.html b/docs/articles/api_overview.html index d3164d6..152a5f8 100644 --- a/docs/articles/api_overview.html +++ b/docs/articles/api_overview.html @@ -87,7 +87,7 @@

    API Overview

    diff --git a/docs/articles/arguments.html b/docs/articles/arguments.html index 52bfb97..83b0b02 100644 --- a/docs/articles/arguments.html +++ b/docs/articles/arguments.html @@ -109,6 +109,10 @@

    Example

    // un-mapped operands are stored [Operand(Position: 1)] public decimal FirstOperand { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } }

    Attributes

    We use Attributes to define CLI functionality

    @@ -191,6 +195,10 @@

    Use case

    [Required] [Operand(1)] public string Message { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } enum MessageImportanceEnum { @@ -238,7 +246,7 @@

    Use case

    diff --git a/docs/articles/commands.html b/docs/articles/commands.html index 2dbe646..d134c9c 100644 --- a/docs/articles/commands.html +++ b/docs/articles/commands.html @@ -103,6 +103,10 @@

    Basic Usage

    // var arguments = Cli.Parse<Command2CliArguments>(args); // ...Application logic } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } }

    Attributes

    There are several attributes which can be applied to a CliCommands class

    @@ -131,7 +135,7 @@
    [Help(detail = string)]
    diff --git a/docs/articles/help_generator.html b/docs/articles/help_generator.html index db93013..ed5dd47 100644 --- a/docs/articles/help_generator.html +++ b/docs/articles/help_generator.html @@ -95,6 +95,10 @@
    CliCommands
    public void Command1(string[] args) { // ...etc } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } class CommandsHelpProgram { @@ -121,6 +125,10 @@
    CliCommands
    [OptionParameter(LongName: "value1")] [Help("Some value to set")] public bool Value1 { get; set; } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } class ArgumentsHelpProgram { @@ -156,6 +164,10 @@
    CliCommands
    Console.WriteLine(helpText); throw new HelpInvokedException("Using an exception to control application flow"); } + + public override void OnUserFacingException(UserFacingException e, string message) { + throw new NotImplementedException(); + } } @@ -166,7 +178,7 @@
    CliCommands
    diff --git a/docs/articles/intro.html b/docs/articles/intro.html index a4f5127..b0c3144 100644 --- a/docs/articles/intro.html +++ b/docs/articles/intro.html @@ -93,7 +93,7 @@

    Installation

    diff --git a/docs/articles/tips.html b/docs/articles/tips.html index 5ed7526..8a37336 100644 --- a/docs/articles/tips.html +++ b/docs/articles/tips.html @@ -90,7 +90,7 @@

    Tips & Behaviour

    diff --git a/docs/articles/toc.html b/docs/articles/toc.html index 0b13b3e..7d91f70 100644 --- a/docs/articles/toc.html +++ b/docs/articles/toc.html @@ -55,6 +55,9 @@
  • Help Generator
  • +
  • + Invalid Argument Handling +
  • Tips & Behaviour
  • @@ -83,6 +86,9 @@
  • Help Generator
  • +
  • + Invalid Argument Handling +
  • Tips & Behaviour
  • diff --git a/docs/articles/user_facing_exceptions.html b/docs/articles/user_facing_exceptions.html new file mode 100644 index 0000000..a9935b6 --- /dev/null +++ b/docs/articles/user_facing_exceptions.html @@ -0,0 +1,202 @@ + + + + + + + + User Facing Exceptions + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + + +
    + +
    +
    + + + + + + diff --git a/docs/index.html b/docs/index.html index b5718e2..2917baf 100644 --- a/docs/index.html +++ b/docs/index.html @@ -117,7 +117,7 @@

    As simple as...

    diff --git a/docs/manifest.json b/docs/manifest.json index a2ac36a..48d4577 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1 +1 @@ -{"homepages":[],"source_base_path":"C:/Users/nicho/Local/Repositories/EntryPoint/docs-generation/docfx","xrefmap":"xrefmap.yml","files":[{"type":"ManagedReference","source_relative_path":"api/EntryPoint.HelpAttribute.yml","output":{".html":{"relative_path":"api/EntryPoint.HelpAttribute.html","hash":"2PV1XueTcAibfygi1wTFaw=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Exceptions.RequiredException.yml","output":{".html":{"relative_path":"api/EntryPoint.Exceptions.RequiredException.html","hash":"waNCJvWpiPmi5hSudVdOdw=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Exceptions.yml","output":{".html":{"relative_path":"api/EntryPoint.Exceptions.html","hash":"LCcoVCJOLh3+SR0H29NO1w=="}},"is_incremental":false},{"type":"Conceptual","source_relative_path":"api/index.md","output":{".html":{"relative_path":"api/index.html","hash":"M6UJiFYx6L7ntxgnzFWNJQ=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Exceptions.UnknownOptionException.yml","output":{".html":{"relative_path":"api/EntryPoint.Exceptions.UnknownOptionException.html","hash":"4CYvpIHTfVuNO9XvFBuIOg=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Exceptions.UserFacingException.yml","output":{".html":{"relative_path":"api/EntryPoint.Exceptions.UserFacingException.html","hash":"pzRUTQ3DZzp+CmNL1ynlsg=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.DefaultCommandAttribute.yml","output":{".html":{"relative_path":"api/EntryPoint.DefaultCommandAttribute.html","hash":"9BmEcHHSjlGqsZhV3tsRCw=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Exceptions.DuplicateOptionException.yml","output":{".html":{"relative_path":"api/EntryPoint.Exceptions.DuplicateOptionException.html","hash":"bZRb5XJpVm5vNM1Peshwkg=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Exceptions.InvalidModelException.yml","output":{".html":{"relative_path":"api/EntryPoint.Exceptions.InvalidModelException.html","hash":"PMNKl/U9GKHhyIdVApHDjA=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.OperandAttribute.yml","output":{".html":{"relative_path":"api/EntryPoint.OperandAttribute.html","hash":"7yS8imeCVPHKtdM/gFss3Q=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.OptionAttribute.yml","output":{".html":{"relative_path":"api/EntryPoint.OptionAttribute.html","hash":"DUxR9f7dsOGYtBc4m3qcug=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.OptionParameterAttribute.yml","output":{".html":{"relative_path":"api/EntryPoint.OptionParameterAttribute.html","hash":"fiVFSXP06FqoLRhHk+nR+Q=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.BaseCliArguments.yml","output":{".html":{"relative_path":"api/EntryPoint.BaseCliArguments.html","hash":"Cp/HLHllSF9yRt56j5ZpHQ=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.BaseCliCommands.yml","output":{".html":{"relative_path":"api/EntryPoint.BaseCliCommands.html","hash":"uFXGespStmE4fm1m44/N5Q=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Cli.yml","output":{".html":{"relative_path":"api/EntryPoint.Cli.html","hash":"YZwsTpPslCpUlrPHv7VVjg=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.RequiredAttribute.yml","output":{".html":{"relative_path":"api/EntryPoint.RequiredAttribute.html","hash":"sZJgr7TxP9sKoVfls9klsw=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.yml","output":{".html":{"relative_path":"api/EntryPoint.html","hash":"+U7GHj8fT4RFMLCS3AALhg=="}},"is_incremental":false},{"type":"Resource","source_relative_path":"images/favicon.ico","output":{"resource":{"relative_path":"images/favicon.ico"}},"is_incremental":false},{"type":"Resource","source_relative_path":"images/logo.png","output":{"resource":{"relative_path":"images/logo.png"}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.CommandAttribute.yml","output":{".html":{"relative_path":"api/EntryPoint.CommandAttribute.html","hash":"V7iVBurMb/LSqV5zosLgIw=="}},"is_incremental":false},{"type":"Conceptual","source_relative_path":"articles/commands.md","output":{".html":{"relative_path":"articles/commands.html","hash":"f8FkVKevEwTymP5yZKkoSg=="}},"is_incremental":false},{"type":"Conceptual","source_relative_path":"articles/help_generator.md","output":{".html":{"relative_path":"articles/help_generator.html","hash":"27CHnwbYvf1Gbu0fCTQM1w=="}},"is_incremental":false},{"type":"Conceptual","source_relative_path":"articles/intro.md","output":{".html":{"relative_path":"articles/intro.html","hash":"vIqPLZ8LABIWtl1v79SOtA=="}},"is_incremental":false},{"type":"Conceptual","source_relative_path":"articles/tips.md","output":{".html":{"relative_path":"articles/tips.html","hash":"p3D8HuJqxmN43N3FBkljtg=="}},"is_incremental":false},{"type":"Resource","source_relative_path":"images/logo.svg","output":{"resource":{"relative_path":"images/logo.svg"}},"is_incremental":false},{"type":"Toc","source_relative_path":"api/toc.yml","output":{".html":{"relative_path":"api/toc.html","hash":"hdUsbCn2ptr7iYldF3AsfQ=="}},"is_incremental":false},{"type":"Toc","source_relative_path":"toc.yml","output":{".html":{"relative_path":"toc.html","hash":"y7Di83yqX/d4zkggmP0msA=="}},"is_incremental":false},{"type":"Toc","source_relative_path":"articles/toc.yml","output":{".html":{"relative_path":"articles/toc.html","hash":"uaC6oq27fUO8KV0bhAn0cw=="}},"is_incremental":false},{"type":"Conceptual","source_relative_path":"index.md","output":{".html":{"relative_path":"index.html","hash":"IHHtrjK4+xbT0/7SXJ8/Tg=="}},"is_incremental":false},{"type":"Conceptual","source_relative_path":"articles/api_overview.md","output":{".html":{"relative_path":"articles/api_overview.html","hash":"QLFm6QbbyVnY1hgW8YSb5w=="}},"is_incremental":false},{"type":"Conceptual","source_relative_path":"articles/arguments.md","output":{".html":{"relative_path":"articles/arguments.html","hash":"yN4VSehPmSJS3b6LC4Ha+A=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Exceptions.NoParameterException.yml","output":{".html":{"relative_path":"api/EntryPoint.Exceptions.NoParameterException.html","hash":"QLWuIMWjUNgiVB3QYOKPIw=="}},"is_incremental":false}]} \ No newline at end of file +{"homepages":[],"source_base_path":"C:/Users/nicho/Local/Repositories/EntryPoint/docs-generation/docfx","xrefmap":"xrefmap.yml","files":[{"type":"ManagedReference","source_relative_path":"api/EntryPoint.HelpAttribute.yml","output":{".html":{"relative_path":"api/EntryPoint.HelpAttribute.html","hash":"BTADnw3Lu2Rjap3nvd0C7Q=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.OptionParameterAttribute.yml","output":{".html":{"relative_path":"api/EntryPoint.OptionParameterAttribute.html","hash":"tha9pGNDW1h/aa1BHIUXJQ=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Exceptions.UserFacingException.yml","output":{".html":{"relative_path":"api/EntryPoint.Exceptions.UserFacingException.html","hash":"Bc2Jb9UUiZIajtUauydPUg=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.OperandAttribute.yml","output":{".html":{"relative_path":"api/EntryPoint.OperandAttribute.html","hash":"dsvexN3YKpnzr2byM/2bJw=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.OptionAttribute.yml","output":{".html":{"relative_path":"api/EntryPoint.OptionAttribute.html","hash":"7y08nvstbP27iw9wZK6CpA=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.RequiredAttribute.yml","output":{".html":{"relative_path":"api/EntryPoint.RequiredAttribute.html","hash":"9PXr20LwQ9dcy4BGYgYYgQ=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.yml","output":{".html":{"relative_path":"api/EntryPoint.html","hash":"BrTND4LfEWvmVMqZWz1vRg=="}},"is_incremental":false},{"type":"Resource","source_relative_path":"images/favicon.ico","output":{"resource":{"relative_path":"images/favicon.ico"}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Exceptions.IUserFacingExceptionHandler.yml","output":{".html":{"relative_path":"api/EntryPoint.Exceptions.IUserFacingExceptionHandler.html","hash":"78GqB7k9B+Sf66b1BIdNcw=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Exceptions.NoParameterException.yml","output":{".html":{"relative_path":"api/EntryPoint.Exceptions.NoParameterException.html","hash":"oBW9ekbEUehykent7vLYHA=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Exceptions.RequiredException.yml","output":{".html":{"relative_path":"api/EntryPoint.Exceptions.RequiredException.html","hash":"maJT8G+WcCB9bM9Cr5XNiw=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.CommandAttribute.yml","output":{".html":{"relative_path":"api/EntryPoint.CommandAttribute.html","hash":"uZO3OXgItzdv5RTnYJgHbg=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Exceptions.InvalidModelException.yml","output":{".html":{"relative_path":"api/EntryPoint.Exceptions.InvalidModelException.html","hash":"9x0Rp4lGfemTBtaiNbituw=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Exceptions.yml","output":{".html":{"relative_path":"api/EntryPoint.Exceptions.html","hash":"dl+SvzZXWZE+peZfbd/JZg=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Help.IHelpable.yml","output":{".html":{"relative_path":"api/EntryPoint.Help.IHelpable.html","hash":"EVwq6QUOmWuAj580AsDphg=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Help.yml","output":{".html":{"relative_path":"api/EntryPoint.Help.html","hash":"PSFTofJ9oPZ3f/fZItB8Fw=="}},"is_incremental":false},{"type":"Conceptual","source_relative_path":"api/index.md","output":{".html":{"relative_path":"api/index.html","hash":"4QKjL6cGVv3Fqy621CKZ0g=="}},"is_incremental":false},{"type":"Conceptual","source_relative_path":"index.md","output":{".html":{"relative_path":"index.html","hash":"DLoh1hOfGQY9Al36ouXkjA=="}},"is_incremental":false},{"type":"Conceptual","source_relative_path":"articles/api_overview.md","output":{".html":{"relative_path":"articles/api_overview.html","hash":"va5fvBkIMcDpIP0VGom3JA=="}},"is_incremental":false},{"type":"Conceptual","source_relative_path":"articles/arguments.md","output":{".html":{"relative_path":"articles/arguments.html","hash":"3dQMm/Y27zJiGFeTdrriJg=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Exceptions.UnknownOptionException.yml","output":{".html":{"relative_path":"api/EntryPoint.Exceptions.UnknownOptionException.html","hash":"TpIbH9N9NBVvNCb0TuzvEw=="}},"is_incremental":false},{"type":"Resource","source_relative_path":"images/logo.png","output":{"resource":{"relative_path":"images/logo.png"}},"is_incremental":false},{"type":"Resource","source_relative_path":"images/logo.svg","output":{"resource":{"relative_path":"images/logo.svg"}},"is_incremental":false},{"type":"Toc","source_relative_path":"api/toc.yml","output":{".html":{"relative_path":"api/toc.html","hash":"KArBITx9V9jnFgeaehPgaA=="}},"is_incremental":false},{"type":"Toc","source_relative_path":"toc.yml","output":{".html":{"relative_path":"toc.html","hash":"y7Di83yqX/d4zkggmP0msA=="}},"is_incremental":false},{"type":"Toc","source_relative_path":"articles/toc.yml","output":{".html":{"relative_path":"articles/toc.html","hash":"ICP9FBOh5TdJNoc57W8Y9g=="}},"is_incremental":false},{"type":"Conceptual","source_relative_path":"articles/user_facing_exceptions.md","output":{".html":{"relative_path":"articles/user_facing_exceptions.html","hash":"QofQkSJ+rsK/j67IPMavQg=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.DefaultCommandAttribute.yml","output":{".html":{"relative_path":"api/EntryPoint.DefaultCommandAttribute.html","hash":"/g5pRBZSeKPIeC+xXxrTPg=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Exceptions.DuplicateOptionException.yml","output":{".html":{"relative_path":"api/EntryPoint.Exceptions.DuplicateOptionException.html","hash":"qzMVhkDcrmL6JKkn3mcpqg=="}},"is_incremental":false},{"type":"Conceptual","source_relative_path":"articles/tips.md","output":{".html":{"relative_path":"articles/tips.html","hash":"ngsk1wcurcMRwRtWrgRL7Q=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.BaseCliArguments.yml","output":{".html":{"relative_path":"api/EntryPoint.BaseCliArguments.html","hash":"Q2sbCdXJh26GGsspo3E5oA=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.BaseCliCommands.yml","output":{".html":{"relative_path":"api/EntryPoint.BaseCliCommands.html","hash":"xpvdhxR7mYFP/vg4TIw9QQ=="}},"is_incremental":false},{"type":"ManagedReference","source_relative_path":"api/EntryPoint.Cli.yml","output":{".html":{"relative_path":"api/EntryPoint.Cli.html","hash":"a72eZ5M58uVlxRCLDu4q0Q=="}},"is_incremental":false},{"type":"Conceptual","source_relative_path":"articles/commands.md","output":{".html":{"relative_path":"articles/commands.html","hash":"g+gDU3qmRagTA2kXSvGjSg=="}},"is_incremental":false},{"type":"Conceptual","source_relative_path":"articles/help_generator.md","output":{".html":{"relative_path":"articles/help_generator.html","hash":"XLkjlbIgU+4pdllvYGL50Q=="}},"is_incremental":false},{"type":"Conceptual","source_relative_path":"articles/intro.md","output":{".html":{"relative_path":"articles/intro.html","hash":"xK/27EmAMkLc0EJI9GRZtA=="}},"is_incremental":false}]} \ No newline at end of file diff --git a/docs/xrefmap.yml b/docs/xrefmap.yml index c2f347e..8a99386 100644 --- a/docs/xrefmap.yml +++ b/docs/xrefmap.yml @@ -37,6 +37,30 @@ references: commentId: Overload:EntryPoint.BaseCliArguments.HelpInvoked fullName: EntryPoint.BaseCliArguments.HelpInvoked nameWithType: BaseCliArguments.HelpInvoked +- uid: EntryPoint.BaseCliArguments.OnHelpInvoked(System.String) + name: OnHelpInvoked(String) + href: api/EntryPoint.BaseCliArguments.html#EntryPoint_BaseCliArguments_OnHelpInvoked_System_String_ + commentId: M:EntryPoint.BaseCliArguments.OnHelpInvoked(System.String) + fullName: EntryPoint.BaseCliArguments.OnHelpInvoked(System.String) + nameWithType: BaseCliArguments.OnHelpInvoked(String) +- uid: EntryPoint.BaseCliArguments.OnHelpInvoked* + name: OnHelpInvoked + href: api/EntryPoint.BaseCliArguments.html#EntryPoint_BaseCliArguments_OnHelpInvoked_ + commentId: Overload:EntryPoint.BaseCliArguments.OnHelpInvoked + fullName: EntryPoint.BaseCliArguments.OnHelpInvoked + nameWithType: BaseCliArguments.OnHelpInvoked +- uid: EntryPoint.BaseCliArguments.OnUserFacingException(EntryPoint.Exceptions.UserFacingException,System.String) + name: OnUserFacingException(UserFacingException, String) + href: api/EntryPoint.BaseCliArguments.html#EntryPoint_BaseCliArguments_OnUserFacingException_EntryPoint_Exceptions_UserFacingException_System_String_ + commentId: M:EntryPoint.BaseCliArguments.OnUserFacingException(EntryPoint.Exceptions.UserFacingException,System.String) + fullName: EntryPoint.BaseCliArguments.OnUserFacingException(EntryPoint.Exceptions.UserFacingException, System.String) + nameWithType: BaseCliArguments.OnUserFacingException(UserFacingException, String) +- uid: EntryPoint.BaseCliArguments.OnUserFacingException* + name: OnUserFacingException + href: api/EntryPoint.BaseCliArguments.html#EntryPoint_BaseCliArguments_OnUserFacingException_ + commentId: Overload:EntryPoint.BaseCliArguments.OnUserFacingException + fullName: EntryPoint.BaseCliArguments.OnUserFacingException + nameWithType: BaseCliArguments.OnUserFacingException - uid: EntryPoint.BaseCliArguments.Operands name: Operands href: api/EntryPoint.BaseCliArguments.html#EntryPoint_BaseCliArguments_Operands @@ -49,12 +73,72 @@ references: commentId: Overload:EntryPoint.BaseCliArguments.Operands fullName: EntryPoint.BaseCliArguments.Operands nameWithType: BaseCliArguments.Operands +- uid: EntryPoint.BaseCliArguments.UserFacingExceptionThrown + name: UserFacingExceptionThrown + href: api/EntryPoint.BaseCliArguments.html#EntryPoint_BaseCliArguments_UserFacingExceptionThrown + commentId: P:EntryPoint.BaseCliArguments.UserFacingExceptionThrown + fullName: EntryPoint.BaseCliArguments.UserFacingExceptionThrown + nameWithType: BaseCliArguments.UserFacingExceptionThrown +- uid: EntryPoint.BaseCliArguments.UserFacingExceptionThrown* + name: UserFacingExceptionThrown + href: api/EntryPoint.BaseCliArguments.html#EntryPoint_BaseCliArguments_UserFacingExceptionThrown_ + commentId: Overload:EntryPoint.BaseCliArguments.UserFacingExceptionThrown + fullName: EntryPoint.BaseCliArguments.UserFacingExceptionThrown + nameWithType: BaseCliArguments.UserFacingExceptionThrown - uid: EntryPoint.BaseCliCommands name: BaseCliCommands href: api/EntryPoint.BaseCliCommands.html commentId: T:EntryPoint.BaseCliCommands fullName: EntryPoint.BaseCliCommands nameWithType: BaseCliCommands +- uid: EntryPoint.BaseCliCommands.HelpInvoked + name: HelpInvoked + href: api/EntryPoint.BaseCliCommands.html#EntryPoint_BaseCliCommands_HelpInvoked + commentId: P:EntryPoint.BaseCliCommands.HelpInvoked + fullName: EntryPoint.BaseCliCommands.HelpInvoked + nameWithType: BaseCliCommands.HelpInvoked +- uid: EntryPoint.BaseCliCommands.HelpInvoked* + name: HelpInvoked + href: api/EntryPoint.BaseCliCommands.html#EntryPoint_BaseCliCommands_HelpInvoked_ + commentId: Overload:EntryPoint.BaseCliCommands.HelpInvoked + fullName: EntryPoint.BaseCliCommands.HelpInvoked + nameWithType: BaseCliCommands.HelpInvoked +- uid: EntryPoint.BaseCliCommands.OnHelpInvoked(System.String) + name: OnHelpInvoked(String) + href: api/EntryPoint.BaseCliCommands.html#EntryPoint_BaseCliCommands_OnHelpInvoked_System_String_ + commentId: M:EntryPoint.BaseCliCommands.OnHelpInvoked(System.String) + fullName: EntryPoint.BaseCliCommands.OnHelpInvoked(System.String) + nameWithType: BaseCliCommands.OnHelpInvoked(String) +- uid: EntryPoint.BaseCliCommands.OnHelpInvoked* + name: OnHelpInvoked + href: api/EntryPoint.BaseCliCommands.html#EntryPoint_BaseCliCommands_OnHelpInvoked_ + commentId: Overload:EntryPoint.BaseCliCommands.OnHelpInvoked + fullName: EntryPoint.BaseCliCommands.OnHelpInvoked + nameWithType: BaseCliCommands.OnHelpInvoked +- uid: EntryPoint.BaseCliCommands.OnUserFacingException(EntryPoint.Exceptions.UserFacingException,System.String) + name: OnUserFacingException(UserFacingException, String) + href: api/EntryPoint.BaseCliCommands.html#EntryPoint_BaseCliCommands_OnUserFacingException_EntryPoint_Exceptions_UserFacingException_System_String_ + commentId: M:EntryPoint.BaseCliCommands.OnUserFacingException(EntryPoint.Exceptions.UserFacingException,System.String) + fullName: EntryPoint.BaseCliCommands.OnUserFacingException(EntryPoint.Exceptions.UserFacingException, System.String) + nameWithType: BaseCliCommands.OnUserFacingException(UserFacingException, String) +- uid: EntryPoint.BaseCliCommands.OnUserFacingException* + name: OnUserFacingException + href: api/EntryPoint.BaseCliCommands.html#EntryPoint_BaseCliCommands_OnUserFacingException_ + commentId: Overload:EntryPoint.BaseCliCommands.OnUserFacingException + fullName: EntryPoint.BaseCliCommands.OnUserFacingException + nameWithType: BaseCliCommands.OnUserFacingException +- uid: EntryPoint.BaseCliCommands.UserFacingExceptionThrown + name: UserFacingExceptionThrown + href: api/EntryPoint.BaseCliCommands.html#EntryPoint_BaseCliCommands_UserFacingExceptionThrown + commentId: P:EntryPoint.BaseCliCommands.UserFacingExceptionThrown + fullName: EntryPoint.BaseCliCommands.UserFacingExceptionThrown + nameWithType: BaseCliCommands.UserFacingExceptionThrown +- uid: EntryPoint.BaseCliCommands.UserFacingExceptionThrown* + name: UserFacingExceptionThrown + href: api/EntryPoint.BaseCliCommands.html#EntryPoint_BaseCliCommands_UserFacingExceptionThrown_ + commentId: Overload:EntryPoint.BaseCliCommands.UserFacingExceptionThrown + fullName: EntryPoint.BaseCliCommands.UserFacingExceptionThrown + nameWithType: BaseCliCommands.UserFacingExceptionThrown - uid: EntryPoint.Cli name: Cli href: api/EntryPoint.Cli.html @@ -214,6 +298,36 @@ references: commentId: T:EntryPoint.Exceptions.InvalidModelException fullName: EntryPoint.Exceptions.InvalidModelException nameWithType: InvalidModelException +- uid: EntryPoint.Exceptions.IUserFacingExceptionHandler + name: IUserFacingExceptionHandler + href: api/EntryPoint.Exceptions.IUserFacingExceptionHandler.html + commentId: T:EntryPoint.Exceptions.IUserFacingExceptionHandler + fullName: EntryPoint.Exceptions.IUserFacingExceptionHandler + nameWithType: IUserFacingExceptionHandler +- uid: EntryPoint.Exceptions.IUserFacingExceptionHandler.OnUserFacingException(EntryPoint.Exceptions.UserFacingException,System.String) + name: OnUserFacingException(UserFacingException, String) + href: api/EntryPoint.Exceptions.IUserFacingExceptionHandler.html#EntryPoint_Exceptions_IUserFacingExceptionHandler_OnUserFacingException_EntryPoint_Exceptions_UserFacingException_System_String_ + commentId: M:EntryPoint.Exceptions.IUserFacingExceptionHandler.OnUserFacingException(EntryPoint.Exceptions.UserFacingException,System.String) + fullName: EntryPoint.Exceptions.IUserFacingExceptionHandler.OnUserFacingException(EntryPoint.Exceptions.UserFacingException, System.String) + nameWithType: IUserFacingExceptionHandler.OnUserFacingException(UserFacingException, String) +- uid: EntryPoint.Exceptions.IUserFacingExceptionHandler.OnUserFacingException* + name: OnUserFacingException + href: api/EntryPoint.Exceptions.IUserFacingExceptionHandler.html#EntryPoint_Exceptions_IUserFacingExceptionHandler_OnUserFacingException_ + commentId: Overload:EntryPoint.Exceptions.IUserFacingExceptionHandler.OnUserFacingException + fullName: EntryPoint.Exceptions.IUserFacingExceptionHandler.OnUserFacingException + nameWithType: IUserFacingExceptionHandler.OnUserFacingException +- uid: EntryPoint.Exceptions.IUserFacingExceptionHandler.UserFacingExceptionThrown + name: UserFacingExceptionThrown + href: api/EntryPoint.Exceptions.IUserFacingExceptionHandler.html#EntryPoint_Exceptions_IUserFacingExceptionHandler_UserFacingExceptionThrown + commentId: P:EntryPoint.Exceptions.IUserFacingExceptionHandler.UserFacingExceptionThrown + fullName: EntryPoint.Exceptions.IUserFacingExceptionHandler.UserFacingExceptionThrown + nameWithType: IUserFacingExceptionHandler.UserFacingExceptionThrown +- uid: EntryPoint.Exceptions.IUserFacingExceptionHandler.UserFacingExceptionThrown* + name: UserFacingExceptionThrown + href: api/EntryPoint.Exceptions.IUserFacingExceptionHandler.html#EntryPoint_Exceptions_IUserFacingExceptionHandler_UserFacingExceptionThrown_ + commentId: Overload:EntryPoint.Exceptions.IUserFacingExceptionHandler.UserFacingExceptionThrown + fullName: EntryPoint.Exceptions.IUserFacingExceptionHandler.UserFacingExceptionThrown + nameWithType: IUserFacingExceptionHandler.UserFacingExceptionThrown - uid: EntryPoint.Exceptions.NoParameterException name: NoParameterException href: api/EntryPoint.Exceptions.NoParameterException.html @@ -238,6 +352,42 @@ references: commentId: T:EntryPoint.Exceptions.UserFacingException fullName: EntryPoint.Exceptions.UserFacingException nameWithType: UserFacingException +- uid: EntryPoint.Help + name: EntryPoint.Help + href: api/EntryPoint.Help.html + commentId: N:EntryPoint.Help + fullName: EntryPoint.Help + nameWithType: EntryPoint.Help +- uid: EntryPoint.Help.IHelpable + name: IHelpable + href: api/EntryPoint.Help.IHelpable.html + commentId: T:EntryPoint.Help.IHelpable + fullName: EntryPoint.Help.IHelpable + nameWithType: IHelpable +- uid: EntryPoint.Help.IHelpable.HelpInvoked + name: HelpInvoked + href: api/EntryPoint.Help.IHelpable.html#EntryPoint_Help_IHelpable_HelpInvoked + commentId: P:EntryPoint.Help.IHelpable.HelpInvoked + fullName: EntryPoint.Help.IHelpable.HelpInvoked + nameWithType: IHelpable.HelpInvoked +- uid: EntryPoint.Help.IHelpable.HelpInvoked* + name: HelpInvoked + href: api/EntryPoint.Help.IHelpable.html#EntryPoint_Help_IHelpable_HelpInvoked_ + commentId: Overload:EntryPoint.Help.IHelpable.HelpInvoked + fullName: EntryPoint.Help.IHelpable.HelpInvoked + nameWithType: IHelpable.HelpInvoked +- uid: EntryPoint.Help.IHelpable.OnHelpInvoked(System.String) + name: OnHelpInvoked(String) + href: api/EntryPoint.Help.IHelpable.html#EntryPoint_Help_IHelpable_OnHelpInvoked_System_String_ + commentId: M:EntryPoint.Help.IHelpable.OnHelpInvoked(System.String) + fullName: EntryPoint.Help.IHelpable.OnHelpInvoked(System.String) + nameWithType: IHelpable.OnHelpInvoked(String) +- uid: EntryPoint.Help.IHelpable.OnHelpInvoked* + name: OnHelpInvoked + href: api/EntryPoint.Help.IHelpable.html#EntryPoint_Help_IHelpable_OnHelpInvoked_ + commentId: Overload:EntryPoint.Help.IHelpable.OnHelpInvoked + fullName: EntryPoint.Help.IHelpable.OnHelpInvoked + nameWithType: IHelpable.OnHelpInvoked - uid: EntryPoint.HelpAttribute name: HelpAttribute href: api/EntryPoint.HelpAttribute.html From 95bed6e91e21a3d4a07d8f6b2a95b7f50d7418af Mon Sep 17 00:00:00 2001 From: Nick Lucas Date: Sun, 12 Feb 2017 18:36:22 +0000 Subject: [PATCH 13/13] Push version to 1.1.0 --- src/EntryPoint/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EntryPoint/project.json b/src/EntryPoint/project.json index b6822f2..abf61be 100644 --- a/src/EntryPoint/project.json +++ b/src/EntryPoint/project.json @@ -1,5 +1,5 @@ { - "version": "1.0.1", + "version": "1.1.0", "title": "EntryPoint", "description": "Lightweight and Composable CLI Argument Parser for all modern .Net platforms", "authors": [ "Nick Lucas" ],