-
-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
89 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using CliFx; | ||
using CliFx.Attributes; | ||
using CliFx.Infrastructure; | ||
|
||
namespace CliWrap.Tests.Dummy.Commands; | ||
|
||
[Command("env")] | ||
public class EnvironmentCommand : ICommand | ||
{ | ||
[CommandParameter(0)] | ||
public IReadOnlyList<string> Names { get; init; } = Array.Empty<string>(); | ||
|
||
public async ValueTask ExecuteAsync(IConsole console) | ||
{ | ||
foreach (var name in Names) | ||
await console.Output.WriteLineAsync(Environment.GetEnvironmentVariable(name)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
CliWrap.Tests.Dummy/Commands/PrintEnvironmentVariablesCommand.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
using CliFx; | ||
using CliFx.Attributes; | ||
using CliFx.Infrastructure; | ||
|
||
namespace CliWrap.Tests.Dummy.Commands; | ||
|
||
[Command("cwd")] | ||
public class WorkingDirectoryCommand : ICommand | ||
{ | ||
public async ValueTask ExecuteAsync(IConsole console) => | ||
await console.Output.WriteLineAsync(Directory.GetCurrentDirectory()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using FluentAssertions; | ||
using FluentAssertions.Primitives; | ||
|
||
namespace CliWrap.Tests.Utils.Extensions; | ||
|
||
internal static class AssertionExtensions | ||
{ | ||
public static void ConsistOfLines( | ||
this StringAssertions assertions, | ||
IEnumerable<string> lines | ||
) => | ||
assertions | ||
.Subject | ||
.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries) | ||
.Should() | ||
.Equal(lines); | ||
|
||
public static void ConsistOfLines(this StringAssertions assertions, params string[] lines) => | ||
assertions.ConsistOfLines((IEnumerable<string>)lines); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters