Skip to content

Commit

Permalink
Update logo
Browse files Browse the repository at this point in the history
NikolayPianikov committed Jul 18, 2024
1 parent 142733d commit 0749be3
Showing 9 changed files with 36 additions and 43 deletions.
1 change: 1 addition & 0 deletions CSharpInteractive/CSharpInteractive.Tool.csproj
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
<ProjectOutputPath>$(configuration)/$(MSBuildThisFileName)</ProjectOutputPath>
<OutputPath>bin/$(ProjectOutputPath)</OutputPath>
<IntermediateOutputPath>obj/$(MSBuildThisFileName)/</IntermediateOutputPath>
<ApplicationIcon>../docs/icon.ico</ApplicationIcon>
</PropertyGroup>

<PropertyGroup>
74 changes: 32 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -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) [<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:OpenSourceProjects_DevTeam_CScriptInteractive_BuildAndTest)/statusIcon.svg"/>](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<ICommandLineRunner>().Run(new CommandLine("cmd", "/c", "DIR"));
exitCode.ShouldBe(0);
GetService<ICommandLineRunner>().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<ICommandLineRunner>().RunAsync(new CommandLine("cmd", "/C", "DIR"));
var task = await GetService<ICommandLineRunner>().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<string>();
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<int?> 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<int?> 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();
```


4 changes: 3 additions & 1 deletion README_BODY.md
Original file line number Diff line number Diff line change
@@ -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) [<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:OpenSourceProjects_DevTeam_CScriptInteractive_BuildAndTest)/statusIcon.svg"/>](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
Binary file added docs/[Originals]/csharp_cat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/cat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/csharp_cat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/icon.ico
Binary file not shown.
Binary file added docs/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0749be3

Please sign in to comment.