Skip to content

Commit

Permalink
feat(cli): add --force-analyze argument
Browse files Browse the repository at this point in the history
  • Loading branch information
akiver committed Jul 10, 2022
1 parent e37b9ef commit a514660
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CLI/ExportCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal abstract class ExportCommand : BaseCommand
protected Source _source;
protected readonly List<string> _demoPaths;
protected string _outputFolderPath;
protected bool _forceAnalyze = false;
protected List<string> _availableSources = new List<string>();

public ExportCommand(string commandName, string description) : base(commandName, description)
Expand Down Expand Up @@ -80,6 +81,9 @@ protected void ParseArgs(string[] args, string[] allowedOptions)
Environment.Exit(1);
}

break;
case "--force-analyze":
_forceAnalyze = true;
break;
default:
if (!allowedOptions.Contains(arg))
Expand Down
5 changes: 3 additions & 2 deletions CLI/JsonCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ public override void PrintHelp()
{
Console.WriteLine(GetDescription());
Console.WriteLine(@"");
Console.WriteLine($@"Usage: {Program.ExeName} {COMMAND_NAME} demoPaths... [--output] [--source]");
Console.WriteLine($@"Usage: {Program.ExeName} {COMMAND_NAME} demoPaths... [--output] [--source] [--force-analyze]");
Console.WriteLine(@"");
Console.WriteLine(@"Demos path can be either .dem files location or a directory. It can be relative or absolute.");
Console.WriteLine(@"The --output argument specify the directory where output files will be saved.");
Console.WriteLine($@"The --source argument force the analysis logic of the demo analyzer. Available values: [{string.Join(",", _availableSources)}]");
Console.WriteLine(@"The --force-analyze argument force demos analyzes (ignore cached data).");
Console.WriteLine(@"");
Console.WriteLine(@"Examples:");
Console.WriteLine(@"");
Expand Down Expand Up @@ -72,7 +73,7 @@ public override async Task Run(string[] args)
demo.Source = _source;
}

if (cacheService.HasDemoInCache(demo.Id))
if (!_forceAnalyze && cacheService.HasDemoInCache(demo.Id))
{
demo = await cacheService.GetDemoDataFromCache(demo.Id);
demo.WeaponFired = await cacheService.GetDemoWeaponFiredAsync(demo);
Expand Down
5 changes: 3 additions & 2 deletions CLI/XlsxCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ public override void PrintHelp()
{
Console.WriteLine(GetDescription());
Console.WriteLine(@"");
Console.WriteLine($@"Usage: {Program.ExeName} {COMMAND_NAME} demoPaths... [--output] [--source] [--single]");
Console.WriteLine($@"Usage: {Program.ExeName} {COMMAND_NAME} demoPaths... [--output] [--source] [--single] [--force-analyze]");
Console.WriteLine(@"");
Console.WriteLine(@"Demos path can be either .dem files location or a directory. It can be relative or absolute.");
Console.WriteLine(@"The --output argument specify the directory where output files will be saved.");
Console.WriteLine($@"The --source argument force the analysis logic of the demo analyzer. Available values: [{string.Join(",", _availableSources)}]");
Console.WriteLine($@"The --single argument generates a single XLSX file instead of one per demo.");
Console.WriteLine(@"The --force-analyze argument force demos analyzes (ignore cached data).");
Console.WriteLine(@"");
Console.WriteLine(@"Examples:");
Console.WriteLine(@"");
Expand Down Expand Up @@ -87,7 +88,7 @@ public override async Task Run(string[] args)
demo.Source = _source;
}

if (cacheService.HasDemoInCache(demo.Id))
if (!_forceAnalyze && cacheService.HasDemoInCache(demo.Id))
{
demo = await cacheService.GetDemoDataFromCache(demo.Id);
demo.WeaponFired = await cacheService.GetDemoWeaponFiredAsync(demo);
Expand Down

0 comments on commit a514660

Please sign in to comment.