Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
9758131a
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9758131a
编写于
1月 29, 2019
作者:
S
Sam Harwell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update System.CommandLine to 0.1.0-alpha-63729-01
上级
f8c9b287
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
14 addition
and
11 deletion
+14
-11
NuGet.config
NuGet.config
+1
-0
eng/Versions.props
eng/Versions.props
+2
-1
src/Tools/dotnet-format/Logging/SimpleConsoleLogger.cs
src/Tools/dotnet-format/Logging/SimpleConsoleLogger.cs
+6
-5
src/Tools/dotnet-format/Program.cs
src/Tools/dotnet-format/Program.cs
+4
-5
src/Tools/dotnet-format/dotnet-format.csproj
src/Tools/dotnet-format/dotnet-format.csproj
+1
-0
未找到文件。
NuGet.config
浏览文件 @
9758131a
...
...
@@ -11,6 +11,7 @@
<
packageSources
>
<
clear
/>
<
add
key
=
"dotnet-core"
value
=
"https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json"
/>
<
add
key
=
"system-commandline"
value
=
"https://dotnet.myget.org/F/system-commandline/api/v3/index.json"
/>
</
packageSources
>
<
disabledPackageSources
>
<
clear
/>
...
...
eng/Versions.props
浏览文件 @
9758131a
...
...
@@ -162,7 +162,8 @@
<RoslynMicrosoftVisualStudioExtensionManagerVersion>
0.0.4
</RoslynMicrosoftVisualStudioExtensionManagerVersion>
<StreamJsonRpcVersion>
1.3.23
</StreamJsonRpcVersion>
<SystemCollectionsImmutableVersion>
1.5.0
</SystemCollectionsImmutableVersion>
<SystemCommandLineExperimentalVersion>
0.1.0-alpha-63227-01
</SystemCommandLineExperimentalVersion>
<SystemCommandLineExperimentalVersion>
0.1.0-alpha-63729-01
</SystemCommandLineExperimentalVersion>
<SystemCommandLineRenderingVersion>
0.1.0-alpha-63729-01
</SystemCommandLineRenderingVersion>
<SystemDrawingCommonVersion>
4.5.0
</SystemDrawingCommonVersion>
<SystemIOFileSystemVersion>
4.3.0
</SystemIOFileSystemVersion>
<SystemIOFileSystemPrimitivesVersion>
4.3.0
</SystemIOFileSystemPrimitivesVersion>
...
...
src/Tools/dotnet-format/Logging/SimpleConsoleLogger.cs
浏览文件 @
9758131a
...
...
@@ -4,6 +4,7 @@
using
System.Collections.Generic
;
using
System.Collections.Immutable
;
using
System.CommandLine
;
using
System.CommandLine.Rendering
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Logging.Abstractions.Internal
;
...
...
@@ -11,7 +12,7 @@ namespace Microsoft.CodeAnalysis.Tools.Logging
{
internal
class
SimpleConsoleLogger
:
ILogger
{
private
readonly
I
Console
_console
;
private
readonly
I
Terminal
_terminal
;
private
readonly
LogLevel
_logLevel
;
private
static
readonly
ImmutableDictionary
<
LogLevel
,
ConsoleColor
>
_logLevelColorMap
=
new
Dictionary
<
LogLevel
,
ConsoleColor
>
...
...
@@ -27,7 +28,7 @@ internal class SimpleConsoleLogger : ILogger
public
SimpleConsoleLogger
(
IConsole
console
,
LogLevel
logLevel
)
{
_
console
=
console
;
_
terminal
=
console
.
GetTerminal
()
;
_logLevel
=
logLevel
;
}
...
...
@@ -39,12 +40,12 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
}
var
messageColor
=
_logLevelColorMap
[
logLevel
];
_
console
.
ForegroundColor
=
messageColor
;
_
terminal
.
ForegroundColor
=
messageColor
;
var
message
=
formatter
(
state
,
exception
);
_
console
.
Out
.
WriteLine
(
$"
{
message
}
"
);
_
terminal
.
Out
.
WriteLine
(
$"
{
message
}
"
);
_
console
.
ResetColor
();
_
terminal
.
ResetColor
();
}
public
bool
IsEnabled
(
LogLevel
logLevel
)
...
...
src/Tools/dotnet-format/Program.cs
浏览文件 @
9758131a
...
...
@@ -20,16 +20,15 @@ class Program
static
async
Task
<
int
>
Main
(
string
[]
args
)
{
var
parser
=
new
CommandLineBuilder
()
var
parser
=
new
CommandLineBuilder
(
new
Command
(
"dotnet-format"
,
handler
:
CommandHandler
.
Create
(
typeof
(
Program
).
GetMethod
(
nameof
(
Run
))))
)
.
UseParseDirective
()
.
UseHelp
()
.
UseSuggestDirective
()
.
UseParseErrorReporting
()
.
UseExceptionHandler
()
.
AddOption
(
new
[]
{
"-w"
,
"--workspace"
},
Resources
.
The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one
,
a
=>
a
.
WithDefaultValue
(()
=>
null
).
ParseArgumentsAs
<
string
>())
.
AddOption
(
new
[]
{
"-v"
,
"--verbosity"
},
Resources
.
Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic
,
a
=>
a
.
FromAmong
(
_verbosityLevels
).
ExactlyOne
())
.
AddVersionOption
()
.
OnExecute
(
typeof
(
Program
).
GetMethod
(
nameof
(
Run
)))
.
AddOption
(
new
Option
(
new
[]
{
"-w"
,
"--workspace"
},
Resources
.
The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one
,
new
Argument
<
string
>(()
=>
null
)))
.
AddOption
(
new
Option
(
new
[]
{
"-v"
,
"--verbosity"
},
Resources
.
Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic
,
new
Argument
<
string
>()
{
Arity
=
ArgumentArity
.
ExactlyOne
}.
FromAmong
(
_verbosityLevels
)))
.
UseVersionOption
()
.
Build
();
return
await
parser
.
InvokeAsync
(
args
).
ConfigureAwait
(
false
);
...
...
src/Tools/dotnet-format/dotnet-format.csproj
浏览文件 @
9758131a
...
...
@@ -28,6 +28,7 @@
<ItemGroup>
<PackageReference Include="System.CommandLine.Experimental" Version="$(SystemCommandLineExperimentalVersion)" />
<PackageReference Include="System.CommandLine.Rendering" Version="$(SystemCommandLineRenderingVersion)" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="$(MicrosoftExtensionsDependencyInjectionVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsLoggingVersion)" />
<PackageReference Include="Microsoft.VisualStudio.CodingConventions" Version="$(MicrosoftVisualStudioCodingConventionsVersion)" Publish="true" />
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录