Sitelet https://github.com/belav/csharpier/commit/bdc99702099a1681dd18e3a3303bb08155b5a7d5
Skip to content

Commit bdc9970

Browse files
committed
allow checking formatting with cache
1 parent 1c25993 commit bdc9970

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

‎Src/CSharpier.Cli/FormattingCache.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static async Task<IFormattingCache> InitializeAsync(
3232
CancellationToken cancellationToken
3333
)
3434
{
35-
if (commandLineOptions.NoCache || commandLineOptions.Check)
35+
if (commandLineOptions.NoCache)
3636
{
3737
return NullCache;
3838
}

‎Src/CSharpier.Cli/FormattingCommands.cs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ public static Command CreateCheckCommand()
9090
);
9191
var directoryOrFileArgument = AddDirectoryOrFileArgument(checkCommand);
9292

93+
var noCacheOption = new Option<bool>(
94+
["--no-cache"],
95+
"Bypass the cache to determine if a file needs to be formatted."
96+
);
97+
checkCommand.AddOption(noCacheOption);
9398
checkCommand.AddOption(ConfigPathOption);
9499
checkCommand.AddOption(IgnorePathOption);
95100
checkCommand.AddOption(LogFormatOption);
@@ -102,6 +107,7 @@ public static Command CreateCheckCommand()
102107
checkCommand.SetHandler(async context =>
103108
{
104109
var directoryOrFile = context.ParseResult.GetValueForArgument(directoryOrFileArgument);
110+
var noCache = context.ParseResult.GetValueForOption(noCacheOption);
105111
var noMSBuildCheck = context.ParseResult.GetValueForOption(NoMsBuildCheckOption);
106112
var includeGenerated = context.ParseResult.GetValueForOption(IncludeGeneratedOption);
107113
var compilationErrorsAsWarnings = context.ParseResult.GetValueForOption(
@@ -122,7 +128,7 @@ public static Command CreateCheckCommand()
122128
skipValidation: false,
123129
skipWrite: false,
124130
writeStdout: false,
125-
noCache: false,
131+
noCache,
126132
noMSBuildCheck,
127133
includeGenerated,
128134
compilationErrorsAsWarnings,

0 commit comments

Comments
 (0)