diff --git a/CSharpInteractive/CSharpInteractive.Tool.csproj b/CSharpInteractive/CSharpInteractive.Tool.csproj
index 2a935e7a..5c7c248f 100644
--- a/CSharpInteractive/CSharpInteractive.Tool.csproj
+++ b/CSharpInteractive/CSharpInteractive.Tool.csproj
@@ -13,6 +13,7 @@
$(configuration)/$(MSBuildThisFileName)
bin/$(ProjectOutputPath)
obj/$(MSBuildThisFileName)/
+ ../docs/icon.ico
diff --git a/README.md b/README.md
index 6a94639f..a014c205 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,9 @@
-## C# script tool
+# Build automation system for .NET
[![NuGet csi](https://buildstats.info/nuget/dotnet-csi?includePreReleases=true)](https://www.nuget.org/packages/dotnet-csi) ![GitHub](https://img.shields.io/github/license/devteam/csharp-interactive) [
](http://teamcity.jetbrains.com/viewType.html?buildTypeId=OpenSourceProjects_DevTeam_CScriptInteractive_BuildAndTest&guest=1)
+![](docs/csharp_cat.png)
+
This is a repository of dotnet-csi which is an interactive tool for running C# scripts. It can installed as a command-line tool on Windows, Linux, or macOS.
## Prerequisites
@@ -225,9 +227,8 @@ public void Run()
private class MyTask(ICommandLineRunner runner)
{
-
public int? Run() =>
- runner.Run(new CommandLine("whoami"));
+ runner.Run(new CommandLine("whoami")).ExitCode;
}
```
@@ -358,22 +359,18 @@ cmd = new CommandLine("cmd", "/c", "echo", "Hello")
// Adds the namespace "HostApi" to use Command Line API
using HostApi;
-var exitCode = GetService().Run(new CommandLine("cmd", "/c", "DIR"));
-exitCode.ShouldBe(0);
+GetService().Run(new CommandLine("cmd", "/c", "DIR")).EnsureSuccess();
// or the same thing using the extension method
-exitCode = new CommandLine("cmd", "/c", "DIR").Run();
-exitCode.ShouldBe(0);
+new CommandLine("cmd", "/c", "DIR").Run().EnsureSuccess();
// using operator '+'
var cmd = new CommandLine("cmd") + "/c" + "DIR";
-exitCode = cmd.Run();
-exitCode.ShouldBe(0);
+cmd.Run().EnsureSuccess();
// with environment variables
cmd = new CommandLine("cmd") + "/c" + "DIR" + ("MyEnvVar", "Some Value");
-exitCode = cmd.Run();
-exitCode.ShouldBe(0);
+cmd.Run().EnsureSuccess();
```
@@ -386,10 +383,10 @@ exitCode.ShouldBe(0);
// Adds the namespace "HostApi" to use Command Line API
using HostApi;
-int? exitCode = await GetService().RunAsync(new CommandLine("cmd", "/C", "DIR"));
+var task = await GetService().RunAsync(new CommandLine("cmd", "/C", "DIR"));
// or the same thing using the extension method
-exitCode = await new CommandLine("cmd", "/c", "DIR").RunAsync();
+task = await new CommandLine("cmd", "/c", "DIR").RunAsync();
```
@@ -405,7 +402,7 @@ using HostApi;
var lines = new List();
int? exitCode = new CommandLine("cmd", "/c", "SET")
.AddVars(("MyEnv", "MyVal"))
- .Run(output => lines.Add(output.Line));
+ .Run(output => lines.Add(output.Line)).ExitCode;
lines.ShouldContain("MyEnv=MyVal");
```
@@ -420,8 +417,8 @@ lines.ShouldContain("MyEnv=MyVal");
// Adds the namespace "HostApi" to use Command Line API
using HostApi;
-Task task = new CommandLine("cmd", "/c", "DIR").RunAsync();
-int? exitCode = new CommandLine("cmd", "/c", "SET").Run();
+var task = new CommandLine("cmd", "/c", "DIR").RunAsync();
+var result = new CommandLine("cmd", "/c", "SET").Run();
task.Wait();
```
@@ -436,7 +433,7 @@ The cancellation will kill a related process.
using HostApi;
var cancellationTokenSource = new CancellationTokenSource();
-Task task = new CommandLine("cmd", "/c", "TIMEOUT", "/T", "120").RunAsync(default, cancellationTokenSource.Token);
+var task = new CommandLine("cmd", "/c", "TIMEOUT", "/T", "120").RunAsync(default, cancellationTokenSource.Token);
cancellationTokenSource.CancelAfter(TimeSpan.FromMilliseconds(100));
task.IsCompleted.ShouldBeFalse();
@@ -452,7 +449,7 @@ If timeout expired a process will be killed.
// Adds the namespace "HostApi" to use Command Line API
using HostApi;
-int? exitCode = new CommandLine("cmd", "/c", "TIMEOUT", "/T", "120").Run(default, TimeSpan.FromMilliseconds(1));
+int? exitCode = new CommandLine("cmd", "/c", "TIMEOUT", "/T", "120").Run(default, TimeSpan.FromMilliseconds(1)).ExitCode;
exitCode.HasValue.ShouldBeFalse();
```
@@ -522,9 +519,10 @@ using HostApi;
// Gets the dotnet version, running a command like: "dotnet --version"
NuGetVersion? version = default;
-var exitCode = new DotNetCustom("--version").Run(message => NuGetVersion.TryParse(message.Line, out version));
+var exitCode = new DotNetCustom("--version")
+ .Run(message => NuGetVersion.TryParse(message.Line, out version))
+ .EnsureSuccess();
-exitCode.ShouldBe(0);
version.ShouldNotBeNull();
```
@@ -671,17 +669,16 @@ result.Tests.Count(test => test.State == TestState.Finished).ShouldBe(1);
using HostApi;
// Creates a new test project, running a command like: "dotnet new mstest -n MyTests --force"
-var exitCode = new DotNetNew("mstest", "-n", "MyTests", "--force").Run();
-exitCode.ShouldBe(0);
+new DotNetNew("mstest", "-n", "MyTests", "--force")
+ .Run().EnsureSuccess();
// Creates the tool manifest and installs the dotCover tool locally
// It is better to run the following 2 commands manually
// and commit these changes to a source control
-exitCode = new DotNetNew("tool-manifest").Run();
-exitCode.ShouldBe(0);
+new DotNetNew("tool-manifest").Run().EnsureSuccess();
-exitCode = new DotNetCustom("tool", "install", "--local", "JetBrains.dotCover.GlobalTool").Run();
-exitCode.ShouldBe(0);
+new DotNetCustom("tool", "install", "--local", "JetBrains.dotCover.GlobalTool")
+ .Run().EnsureSuccess();
// Creates a test command
var test = new DotNetTest().WithProject("MyTests");
@@ -707,8 +704,8 @@ result.ExitCode.ShouldBe(0);
result.Tests.Count(i => i.State == TestState.Finished).ShouldBe(1);
// Generates a HTML code coverage report.
-exitCode = new DotNetCustom("dotCover", "report", $"--source={dotCoverSnapshot}", $"--output={dotCoverReport}", "--reportType=HTML").Run();
-exitCode.ShouldBe(0);
+new DotNetCustom("dotCover", "report", $"--source={dotCoverSnapshot}", $"--output={dotCoverReport}", "--reportType=HTML")
+ .Run().EnsureSuccess();
// Check for a dotCover report
File.Exists(dotCoverReport).ShouldBeTrue();
@@ -728,12 +725,10 @@ var projectDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()[..4]
Directory.CreateDirectory(projectDir);
// Creates a local tool manifest
-var exitCode = new DotNetNew("tool-manifest").WithWorkingDirectory(projectDir).Run();
-exitCode.ShouldBe(0);
+new DotNetNew("tool-manifest").WithWorkingDirectory(projectDir).Run().EnsureSuccess();
// Restore local tools
-exitCode = new DotNetToolRestore().WithWorkingDirectory(projectDir).Run();
-exitCode.ShouldBe(0);
+new DotNetToolRestore().WithWorkingDirectory(projectDir).Run().EnsureSuccess();
```
@@ -805,9 +800,7 @@ result.ExitCode.ShouldBe(0);
using HostApi;
// Shuts down all build servers that are started from dotnet.
-var exitCode = new DotNetBuildServerShutdown().Run();
-
-exitCode.ShouldBe(0);
+new DotNetBuildServerShutdown().Run().EnsureSuccess();
```
@@ -866,11 +859,9 @@ var dockerRun = new DockerRun()
// Creates a new library project in a docker container
-var exitCode = dockerRun
+dockerRun
.WithCommandLine(new DotNetCustom("new", "classlib", "-n", "MyLib", "--force"))
- .Run();
-
-exitCode.ShouldBe(0);
+ .Run().EnsureSuccess();
// Builds the library project in a docker container
var result = dockerRun
@@ -901,9 +892,8 @@ var cmd = new CommandLine("whoami");
// Runs the command line in a docker container
var result = new DockerRun(cmd, "mcr.microsoft.com/dotnet/sdk")
.WithAutoRemove(true)
- .Run();
-
-result.ShouldBe(0);
+ .Run()
+ .EnsureSuccess();
```
diff --git a/README_BODY.md b/README_BODY.md
index 51e79381..fdd6b74c 100644
--- a/README_BODY.md
+++ b/README_BODY.md
@@ -1,7 +1,9 @@
-## C# script tool
+# Build automation system for .NET
[![NuGet csi](https://buildstats.info/nuget/dotnet-csi?includePreReleases=true)](https://www.nuget.org/packages/dotnet-csi) ![GitHub](https://img.shields.io/github/license/devteam/csharp-interactive) [
](http://teamcity.jetbrains.com/viewType.html?buildTypeId=OpenSourceProjects_DevTeam_CScriptInteractive_BuildAndTest&guest=1)
+![](docs/csharp_cat.png)
+
This is a repository of dotnet-csi which is an interactive tool for running C# scripts. It can installed as a command-line tool on Windows, Linux, or macOS.
## Prerequisites
diff --git a/docs/[Originals]/csharp_cat.png b/docs/[Originals]/csharp_cat.png
new file mode 100644
index 00000000..d29e318a
Binary files /dev/null and b/docs/[Originals]/csharp_cat.png differ
diff --git a/docs/cat.png b/docs/cat.png
new file mode 100644
index 00000000..2ef3af60
Binary files /dev/null and b/docs/cat.png differ
diff --git a/docs/csharp_cat.png b/docs/csharp_cat.png
new file mode 100644
index 00000000..62834e2c
Binary files /dev/null and b/docs/csharp_cat.png differ
diff --git a/docs/icon.ico b/docs/icon.ico
new file mode 100644
index 00000000..32ab13a2
Binary files /dev/null and b/docs/icon.ico differ
diff --git a/docs/icon.png b/docs/icon.png
new file mode 100644
index 00000000..ea5a5a73
Binary files /dev/null and b/docs/icon.png differ
diff --git a/icon.png b/icon.png
index 3268caf5..ea5a5a73 100644
Binary files a/icon.png and b/icon.png differ