Skip to content

Commit 73cdd1e

Browse files
committed
add optional confing handle
1 parent 4fad27b commit 73cdd1e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ManyConsole.CommandLineUtils/ConsoleCommandDispatcher.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ public static IEnumerable<ConsoleCommand> FindCommandsInAssembly(Assembly assemb
4242
#endif
4343
}
4444

45-
public static int DispatchCommand(IEnumerable<ConsoleCommand> commands, string[] arguments, TextWriter consoleOut)
45+
public static int DispatchCommand(IEnumerable<ConsoleCommand> commands, string[] arguments, TextWriter consoleOut, Action<CommandLineApplication> config = null)
4646
{
4747
var app = new CommandLineApplication();
48-
48+
4949
app.Out = consoleOut;
5050

5151
var assemblyName =Assembly.GetEntryAssembly()?.GetName();
@@ -55,6 +55,8 @@ public static int DispatchCommand(IEnumerable<ConsoleCommand> commands, string[]
5555

5656
app.HelpOption("-?|-h|--help");
5757

58+
config?.Invoke(app);
59+
5860
app.OnExecute(() =>
5961
{
6062
app.ShowHelp();

0 commit comments

Comments
 (0)