@@ -27,9 +27,11 @@ public static async Task<int> Main(string[] args)
27
27
{
28
28
var processor = new Processor ( logger ) ;
29
29
var languages = string . Join ( "|" , processor . Languages ) ;
30
+ var verbose = false ;
30
31
31
32
var context = new ProcessorContext
32
33
{
34
+ IsDryRun = false ,
33
35
Language = "Text" ,
34
36
GenerateStatic = true ,
35
37
TextFormat = "{versionLabel}" ,
@@ -42,7 +44,12 @@ public static async Task<int> Main(string[] args)
42
44
43
45
var options = new OptionSet
44
46
{
45
- { "language=" , $ "target language [{ languages } ]", v => context . Language = v } ,
47
+ { "l|language=" , $ "target language [{ languages } ]", v =>
48
+ {
49
+ context . Language = v ;
50
+ verbose = true ;
51
+ }
52
+ } ,
46
53
{ "namespace=" , "applying namespace" , v => context . Namespace = v } ,
47
54
{ "tfm=" , "target framework moniker definition (TargetFramework)" , v => context . TargetFramework = v } ,
48
55
{ "tfid=" , "target framework identity definition (TargetFrameworkIdentifier)" , v => context . TargetFrameworkIdentity = v } ,
@@ -90,7 +97,9 @@ public static async Task<int> Main(string[] args)
90
97
context . OutputPath = "package.json" ;
91
98
}
92
99
} ,
100
+ { "quiet" , "quiet on stdout" , _ => context . IsQuietOnStandardOutput = true } ,
93
101
{ "dryrun" , "dryrun mode" , _ => context . IsDryRun = true } ,
102
+ { "verbose" , "verbose mode" , _ => verbose = true } ,
94
103
{ "launchDebugger" , "Launch debugger" , _ => launchDebugger = true } ,
95
104
{ "help" , "help" , v => help = v != null } ,
96
105
} ;
@@ -112,6 +121,11 @@ public static async Task<int> Main(string[] args)
112
121
logger . Error ( "" ) ;
113
122
return 1 ;
114
123
}
124
+
125
+ if ( ! verbose )
126
+ {
127
+ logger . SetImportance ( LogImportance . Ignore ) ;
128
+ }
115
129
116
130
context . ProjectDirectory = trails [ 0 ] ;
117
131
@@ -122,29 +136,20 @@ public static async Task<int> Main(string[] args)
122
136
ResultWriter . Write ( resultPath ! , result ) ;
123
137
}
124
138
125
- if ( context . Language switch
126
- {
127
- "Text" => context . IsDryRun ,
128
- "Replace" => context . IsDryRun ,
129
- "NPM" => context . IsDryRun ,
130
- _ => true ,
131
- } )
132
- {
133
- var dryrunDisplay = context . IsDryRun ?
134
- " (dryrun)" : string . Empty ;
135
- var languageDisplay = context . IsDryRun ?
136
- string . Empty : $ "Language={ context . Language } , ";
137
- var tfmDisplay = context . IsDryRun ?
138
- string . Empty : $ "TFM={ context . TargetFramework } , ";
139
+ var dryrunDisplay = context . IsDryRun ?
140
+ " (dryrun)" : string . Empty ;
141
+ var languageDisplay = context . IsDryRun ?
142
+ string . Empty : $ "Language={ context . Language } , ";
143
+ var tfmDisplay = ( context . IsDryRun || string . IsNullOrWhiteSpace ( context . TargetFramework ) ) ?
144
+ string . Empty : $ "TFM={ context . TargetFramework } , ";
139
145
140
- logger . Message (
141
- LogImportance . High ,
142
- "Generated versions code{0}: {1}{2}Version={3}" ,
143
- dryrunDisplay ,
144
- languageDisplay ,
145
- tfmDisplay ,
146
- result . Version ) ;
147
- }
146
+ logger . Message (
147
+ LogImportance . High ,
148
+ "Generated versions code{0}: {1}{2}Version={3}" ,
149
+ dryrunDisplay ,
150
+ languageDisplay ,
151
+ tfmDisplay ,
152
+ result . Version ) ;
148
153
}
149
154
catch ( Exception ex )
150
155
{
0 commit comments