Skip to content

Commit

Permalink
Update getting-started.md
Browse files Browse the repository at this point in the history
  • Loading branch information
alastairlundy committed Feb 14, 2025
1 parent 2b4d9e7 commit 7c4192a
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ Assuming CliRunner version 1 has been released, the following tweaks to your ``.
## Setting up CliRunner

### Dependency Injection
There's 2 main ways of setting up CliRunner with dependency injection: manually, and using CliRunner's ``UseCliRunner`` configuration extension methods.
There's 2 main ways of setting up CliRunner with dependency injection: manually, and using CliRunner's ``AddCliRunner`` configuration extension methods with the ``CliRunner.Extensions.DependencyInjection`` nuget package.

#### Using ``AddCliRunner``
For this approach you'll need the ``CliRunner.Extensions.DependencyInjection`` nuget package.

#### Using ``UseCliRunner``
If your project doesn't already use Dependency Injection, you can set it up as follows:

```csharp
using Microsoft.Extensions.DependencyInjection;

using CliRunner.Extensions;
using CliRunner.Extensions.DependencyInjection;

namespace MyApp;

Expand All @@ -46,8 +48,8 @@ namespace MyApp;

// Register Your other dependencies here
// UseCliRunner goes here
services.UseCliRunner();
// AddCliRunner goes here
services.AddCliRunner();

// Build the service provider
serviceProvider = services.BuildServiceProvider();
Expand Down Expand Up @@ -79,8 +81,10 @@ namespace MyApp;

// Register Your other dependencies here
// UseCliRunner goes here
services.AddSingleton<ICommandPipeHandler, CommandPipeHandler>();
services.AddSingleton<IFilePathResolver, FilePathResolver>();
services.AddSingleton<IProcessRunnerUtility, ProcessRunnerUtility>();
services.AddSingleton<IPipedProcessRunner, PipedProcessRunner>();
services.AddSingleton<IProcessPipeHandler, ProcessPipeHandler>();
services.AddSingleton<IProcessCreator, ProcessCreator>();
services.AddSingleton<ICommandRunner, CommandRunner>();

Expand Down

0 comments on commit 7c4192a

Please sign in to comment.