diff --git a/README.md b/README.md index f2fdc6ef..6d76e065 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ If you go this route, remember add the `--resourceGroup` to all commands requiri Download and unzip the latest CLI.zip file from [Releases](https://github.com/tfsaggregator/aggregator-cli/releases). It requires [.Net Core 2.1](https://www.microsoft.com/net/download) installed on the machine. -To run Aggregator use `dotnet aggregator-cli.dll` followed by a verb and its options. +To run Aggregator run `aggregator-cli` or `dotnet aggregator-cli.dll` followed by a verb and its options. ### Verbs diff --git a/doc/command-examples.md b/doc/command-examples.md index 50714ac2..64252d12 100644 --- a/doc/command-examples.md +++ b/doc/command-examples.md @@ -1,7 +1,7 @@ # Sample Aggregator CLI usage In the following you will find many sample usage of Aggregator CLI commands. -Run `dotnet aggregator-cli.dll` followed by the command and any option. +Run `aggregator-cli` or `dotnet aggregator-cli.dll` followed by the command and any option. All commands accept the `--verbose` option to print additional messages, useful in troubleshooting. diff --git a/src/aggregator-cli/aggregator-cli.cmd b/src/aggregator-cli/aggregator-cli.cmd new file mode 100644 index 00000000..18304002 --- /dev/null +++ b/src/aggregator-cli/aggregator-cli.cmd @@ -0,0 +1,17 @@ +@echo off +REM Search if .Net Core installed +where /Q dotnet +IF %ERRORLEVEL% NEQ 0 ( + echo .Net Core Runtime is missing, please install from https://dotnet.microsoft.com/download + goto bye +) +REM Check .Net Core version +FOR /f "delims=-" %%i IN ('dotnet --version') DO SET _DOTNETVER=%%i +IF q%_DOTNETVER:2.1=%==q%_DOTNETVER% ( + echo Another version of .Net Core Runtime is installed, please install version 2.1 from https://dotnet.microsoft.com/download + goto bye +) +REM All good run aggregator forwarding any parameter +dotnet %~dp0aggregator-cli.dll %* + +:bye \ No newline at end of file diff --git a/src/aggregator-cli/aggregator-cli.csproj b/src/aggregator-cli/aggregator-cli.csproj index 89003634..96f13831 100644 --- a/src/aggregator-cli/aggregator-cli.csproj +++ b/src/aggregator-cli/aggregator-cli.csproj @@ -48,6 +48,9 @@ + + PreserveNewest + PreserveNewest diff --git a/src/aggregator-cli/test/test5.rule b/src/aggregator-cli/test/test5.rule new file mode 100644 index 00000000..7057c621 --- /dev/null +++ b/src/aggregator-cli/test/test5.rule @@ -0,0 +1,9 @@ +.language=Csharp + +if (self.Description.EndsWith(".")) { + self.Description = self.Description.TrimEnd('.'); + return "."; +} else { + return "no ."; +} + diff --git a/src/aggregator-ruleng/Tracker.cs b/src/aggregator-ruleng/Tracker.cs index d0db263a..4d7beb88 100644 --- a/src/aggregator-ruleng/Tracker.cs +++ b/src/aggregator-ruleng/Tracker.cs @@ -79,15 +79,25 @@ internal IList LoadWorkItems( .Select(id => new PermanentWorkItemId(id)) .GroupBy(k => tracked.ContainsKey(k)) .ToDictionary(g => g.Key, g => g.ToList()); + // groups[true] is the set of IDs already tracked + // groups[false] is the set of new IDs var inMemory = tracked .Where(w => groups.ContainsKey(true) ? groups[true].Contains(w.Key) : false) .Select(w => w.Value.Current); - var loaded = loader(groups[false].Select(k => k.Value)); - return inMemory.Union(loaded).ToList(); + if (groups.ContainsKey(false)) + { + var loaded = loader(groups[false].Select(k => k.Value)); + + return inMemory.Union(loaded).ToList(); + } + else + { + return inMemory.ToList(); + } } internal bool IsTracked(WorkItemWrapper workItemWrapper)