FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Smart-Net-CommandLine/Develop/Program.cs at main · usausa/Smart-Net-CommandLine · GitHub
usausa
/
Smart-Net-CommandLine
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Smart-Net-CommandLine
/
Develop
/
Program.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
61 lines (50 loc) · 1.63 KB
Breadcrumbs
Smart-Net-CommandLine
/
Develop
/
Program.cs
Copy path
File metadata and controls
61 lines (50 loc) · 1.63 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using
Develop
;
using
Microsoft
.
Extensions
.
DependencyInjection
;
using
Microsoft
.
Extensions
.
Logging
;
using
Smart
.
CommandLine
.
Hosting
;
// Command host
var
builder
=
CommandHost
.
CreateBuilder
(
args
)
;
Console
.
WriteLine
(
$
"Application:
{
builder
.
Environment
.
ApplicationName
}
"
)
;
Console
.
WriteLine
(
$
"Environment:
{
builder
.
Environment
.
EnvironmentName
}
"
)
;
// Logging
builder
.
Services
.
AddLogging
(
logging
=>
{
logging
.
AddSimpleConsole
(
options
=>
{
options
.
SingleLine
=
true
;
options
.
TimestampFormat
=
"HH:mm:ss.fff "
;
options
.
IncludeScopes
=
true
;
}
)
;
}
)
;
// Services
builder
.
Services
.
AddSingleton
<
GreetService
>
(
)
;
builder
.
Services
.
AddScoped
<
ScopedService
>
(
)
;
// Commands
builder
.
ConfigureCommands
(
commands
=>
{
commands
.
ConfigureRootCommand
(
root
=>
{
root
.
WithDescription
(
"Sample CLI tool"
)
;
}
)
;
commands
.
AddGlobalFilter
<
ExecutionTimeFilter
>
(
order
:
-
100
)
;
commands
.
AddGlobalFilter
<
ExceptionHandlingFilter
>
(
order
:
Int32
.
MaxValue
)
;
commands
.
AddCommand
<
MessageCommand
>
(
)
;
commands
.
AddCommand
<
GreetCommand
>
(
)
;
commands
.
AddCommand
<
FilterCommand
>
(
)
;
commands
.
AddCommand
<
ScopeCommand
>
(
)
;
commands
.
AddCommand
<
ExceptionCommand
>
(
)
;
commands
.
AddCommand
<
UserCommand
>
(
user
=>
{
user
.
AddSubCommand
<
UserListCommand
>
(
)
;
user
.
AddSubCommand
<
UserAddCommand
>
(
)
;
user
.
AddSubCommand
<
UserRoleCommand
>
(
role
=>
{
role
.
AddSubCommand
<
UserRoleAssignCommand
>
(
)
;
role
.
AddSubCommand
<
UserRoleRemoveCommand
>
(
)
;
}
)
;
}
)
;
}
)
;
var
host
=
builder
.
Build
(
)
;
var
exitCode
=
await
host
.
RunAsync
(
)
;
Console
.
WriteLine
(
$
"ExitCode:
{
exitCode
}
"
)
;
return
exitCode
;
Back
|
FazBrowse Home
|
New Git URL