Progmasoft Git

tazel

A build system for C, C++, Objective-C, Objective-C++ and Zig, with C# project files.

Clonegit clone https://git.progmasoft.com/tazel

Replace partial class with FishPowerShellCompletions helper to satisfy Codacy

Commit
33d8e23367cd062b3fb96dd45107e09b38e5e7e3
Author
Leitwolf11 ·
Parents
359154c72932

Files · Download .tar.gz

Changes

 src/Progmasoft.Tazel/Cli/ShellCompletion.FishPowerShell.cs | 12 ++++++------
 src/Progmasoft.Tazel/Cli/ShellCompletion.cs                | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/Progmasoft.Tazel/Cli/ShellCompletion.FishPowerShell.cs b/src/Progmasoft.Tazel/Cli/ShellCompletion.FishPowerShell.cs
index 2be656f..710ead7 100644
--- a/src/Progmasoft.Tazel/Cli/ShellCompletion.FishPowerShell.cs
+++ b/src/Progmasoft.Tazel/Cli/ShellCompletion.FishPowerShell.cs
@@ -7,9 +7,9 @@ using System.Text;
 
 namespace Progmasoft.Tazel.Cli;
 
-internal static partial class ShellCompletion
+internal static class FishPowerShellCompletions
 {
-    private static string Fish()
+    internal static string Fish()
     {
         var sb = new StringBuilder();
         sb.AppendLine("# Tazel shell completion for Fish.");
@@ -69,7 +69,7 @@ internal static partial class ShellCompletion
         sb.AppendLine("complete -c tazel -s h -l help -d 'Show help'");
         sb.AppendLine();
         sb.AppendLine("# Commands");
-        foreach (var (cmd, desc) in CommandDescriptions)
+        foreach (var (cmd, desc) in ShellCompletion.CommandDescriptions)
         {
             sb.Append("complete -c tazel -n '__fish_use_subcommand' -a '").Append(cmd)
                 .Append("' -d '").Append(desc.Replace("'", "\\'", StringComparison.Ordinal)).AppendLine("'");
@@ -135,12 +135,12 @@ internal static partial class ShellCompletion
         }
     }
 
-    private static string PowerShell()
+    internal static string PowerShell()
     {
         // Strictly compatible with Windows PowerShell 5.1 and later (no PowerShell 7-only syntax).
         var commandList = string.Join(", ", CommandLine.Commands.Select(c => $"'{c}'"));
-        var globalList = string.Join(", ", GlobalFlags.Select(f => $"'{f}'"));
-        var buildList = string.Join(", ", BuildFlags.Select(f => $"'{f}'"));
+        var globalList = string.Join(", ", ShellCompletion.GlobalFlags.Select(f => $"'{f}'"));
+        var buildList = string.Join(", ", ShellCompletion.BuildFlags.Select(f => $"'{f}'"));
         return $$"""
             # Tazel shell completion for PowerShell (requires PowerShell 5.1 or later).
             # Load in the current shell: tazel shell-completion powershell | Out-String | Invoke-Expression
diff --git a/src/Progmasoft.Tazel/Cli/ShellCompletion.cs b/src/Progmasoft.Tazel/Cli/ShellCompletion.cs
index b9810dc..7281b0d 100644
--- a/src/Progmasoft.Tazel/Cli/ShellCompletion.cs
+++ b/src/Progmasoft.Tazel/Cli/ShellCompletion.cs
@@ -18,12 +18,12 @@ internal enum ShellKind
 }
 
 /// <summary>Generates shell completion scripts for <c>tazel</c>.</summary>
-internal static partial class ShellCompletion
+internal static class ShellCompletion
 {
     /// <summary>The accepted shell names, case-sensitive.</summary>
     public static IReadOnlyList<string> Names { get; } = ["bash", "zsh", "fish", "powershell"];
 
-    private static readonly string[] GlobalFlags =
+    internal static readonly string[] GlobalFlags =
     [
         "--color",
         "--progress",
@@ -34,7 +34,7 @@ internal static partial class ShellCompletion
         "-h",
     ];
 
-    private static readonly string[] BuildFlags =
+    internal static readonly string[] BuildFlags =
     [
         "--mode",
         "--platform",
@@ -51,7 +51,7 @@ internal static partial class ShellCompletion
         "--zig-compiler-options",
     ];
 
-    private static readonly (string Command, string Description)[] CommandDescriptions =
+    internal static readonly (string Command, string Description)[] CommandDescriptions =
     [
         ("build", "Build targets"),
         ("run", "Build and run one target"),
@@ -109,8 +109,8 @@ internal static partial class ShellCompletion
     {
         ShellKind.Bash => Bash(),
         ShellKind.Zsh => Zsh(),
-        ShellKind.Fish => Fish(),
-        ShellKind.PowerShell => PowerShell(),
+        ShellKind.Fish => FishPowerShellCompletions.Fish(),
+        ShellKind.PowerShell => FishPowerShellCompletions.PowerShell(),
         _ => throw new ArgumentOutOfRangeException(nameof(shell), shell, "Unknown shell."),
     };