@@ -79,6 +79,8 @@ public void Hello(
7979{
8080```
8181
82+ Method parameter will be required parameter , optional parameter will be oprional parameter . Also support boolean flag , if parameter is bool , in default it will be optional parameter and with `- foo ` set true to parameter .
83+
8284`help ` command (or no argument to pass ) shows there detail . This help format is same as `dotnet ` command .
8385
8486```
@@ -306,6 +308,74 @@ public class ExampleApp : ConsoleAppBase
306308
307309> ** NOTE ** : If the method throws an unhandled exception , ConsoleAppFramework always set `1 ` to the exit code .
308310
311+ CommandAttribute
312+ -- -
313+ `CommandAttribute ` enables subscommand on `RunConsoleAppFramework <T >()`(for single type CLI app ), changes command name on `RunConsoleAppFramework ()`(for muilti type command routing ), also describes the description .
314+
315+ ```
316+ RunConsoleAppFramework <App >();
317+
318+ public class App : ConsoleAppBase
319+ {
320+ // as Root Command(no command argument)
321+ public void Run ()
322+ {
323+ }
324+
325+ [Command (" sec" , " sub comman of this app" )]
326+ public void Second ()
327+ {
328+ }
329+ }
330+ ```
331+
332+ ```
333+ RunConsoleAPpFramework ();
334+
335+ public class App2 : ConsoleAppBase
336+ {
337+ // routing command: `app2 exec`
338+ [Command (" exec" , " exec app." )]
339+ public void Exec1 ()
340+ {
341+ }
342+ }
343+
344+
345+ public class App3 : ConsoleAppBase
346+ {
347+ // routing command: `app3 e2`
348+ [Command (" e2" , " exec app 2." )]
349+ public void ExecExec ()
350+ {
351+ }
352+ }
353+ ```
354+
355+ OptionAttribute
356+ -- -
357+ OptionAttribute configure parameter , it can set shortName or order index , and help description .
358+
359+ If you want to add only description , set " " or null to shortName parameter .
360+
361+ ```csharp
362+ public void Hello (
363+ [Option (" n" , " name of send user." )]string name ,
364+ [Option (" r" , " repeat count." )]int repeat = 3 )
365+ {
366+ }
367+
368+ [Command (" escape" )]
369+ public void UrlEscape ([Option (0 , " input of this command" )]string input )
370+ {
371+ }
372+
373+ [Command (" unescape" )]
374+ public void UrlUnescape ([Option (null , " input of this command" )]string input )
375+ {
376+ }
377+ ```
378+
309379Daemon
310380-- -
311381`ConsoleAppBase .Context .CancellationToken ` is lifecycle token of application . In default , ConsoleAppFramework does not abort on received terminate request , you can check `CancellationToken .IsCancellationRequested ` and shutdown gracefully . If use infinite - loop , it becomes daemon program .
0 commit comments