Skip to content

Commit c156611

Browse files
committed
RM
1 parent d39d7fb commit c156611

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

ReadMe.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,22 @@ public void UrlUnescape([Option(null, "input of this command")]string input)
380380
}
381381
```
382382

383+
DefaultValue property override help message of default.
384+
385+
```csharp
386+
public void Hello(
387+
[Option("t", "Display time.", DefaultValue = "DateTime.Now")]DateTime? time = null)
388+
{
389+
if (time == null) time = DateTime.Now;
390+
Console.WriteLine(time);
391+
}
392+
393+
// ---
394+
395+
Options:
396+
-t, -time <DateTime?> Display time. (Default: DateTime.Now)
397+
```
398+
383399
Daemon
384400
---
385401
`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.

sandbox/SingleContainedApp/Program.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,10 @@ static async Task Main(string[] args)
233233
}
234234

235235
public void Hello(
236-
int? foo = null,
237-
[Option("", "", DefaultValue = "DateTime.Today")]DateTime? hello = null)
236+
[Option("t", "Display time.", DefaultValue = "DateTime.Now")]DateTime? time = null)
238237
{
239-
if (hello == null) hello = DateTime.Now;
240-
Console.WriteLine(hello);
238+
if (time == null) time = DateTime.Now;
239+
Console.WriteLine(time);
241240
}
242241
}
243242
}

0 commit comments

Comments
 (0)