Skip to content
This repository was archived by the owner on Dec 17, 2025. It is now read-only.

Commit 885e3fa

Browse files
authored
fix: change Command property to public access modifier (#20)
* fix: change Command property to public access modifier Signed-off-by: Nikolai Emil Damm <nikolaiemildamm@icloud.com> * refactor: change Command property to GetCommand method for clarity Signed-off-by: Nikolai Emil Damm <nikolaiemildamm@icloud.com> --------- Signed-off-by: Nikolai Emil Damm <nikolaiemildamm@icloud.com>
1 parent 5aba166 commit 885e3fa

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

src/DevantlerTech.CiliumCLI/Cilium.cs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,25 @@ public static class Cilium
1111
/// <summary>
1212
/// The Cilium CLI command.
1313
/// </summary>
14-
static Command Command
14+
public static Command GetCommand()
1515
{
16-
get
17-
{
18-
string binaryName = "cilium";
19-
string? pathEnv = Environment.GetEnvironmentVariable("PATH");
16+
string binaryName = "cilium";
17+
string? pathEnv = Environment.GetEnvironmentVariable("PATH");
2018

21-
if (!string.IsNullOrEmpty(pathEnv))
19+
if (!string.IsNullOrEmpty(pathEnv))
20+
{
21+
string[] paths = pathEnv.Split(Path.PathSeparator);
22+
foreach (string dir in paths)
2223
{
23-
string[] paths = pathEnv.Split(Path.PathSeparator);
24-
foreach (string dir in paths)
24+
string fullPath = Path.Combine(dir, binaryName);
25+
if (File.Exists(fullPath))
2526
{
26-
string fullPath = Path.Combine(dir, binaryName);
27-
if (File.Exists(fullPath))
28-
{
29-
return Cli.Wrap(fullPath);
30-
}
27+
return Cli.Wrap(fullPath);
3128
}
3229
}
33-
34-
throw new FileNotFoundException($"The '{binaryName}' CLI was not found in PATH.");
3530
}
31+
32+
throw new FileNotFoundException($"The '{binaryName}' CLI was not found in PATH.");
3633
}
3734

3835
/// <summary>
@@ -54,7 +51,7 @@ static Command Command
5451
using var stdInConsole = input ? Stream.Null : Console.OpenStandardInput();
5552
using var stdOutConsole = silent ? Stream.Null : Console.OpenStandardOutput();
5653
using var stdErrConsole = silent ? Stream.Null : Console.OpenStandardError();
57-
var command = Command.WithArguments(arguments)
54+
var command = GetCommand().WithArguments(arguments)
5855
.WithValidation(validation)
5956
.WithStandardInputPipe(PipeSource.FromStream(stdInConsole))
6057
.WithStandardOutputPipe(PipeTarget.ToStream(stdOutConsole))

0 commit comments

Comments
 (0)