Skip to content

Commit

Permalink
Add backwards compatibility renaming for --protocol
Browse files Browse the repository at this point in the history
Which is now --scheme.

To make the option consistent across all three commands, we renamed --protocol to --scheme so we could always use the shorthand -s regardless of whether there was a -p|--password option too.

This caused older invocations to break since the protocol would be null/empty and thus a matching provider was not found (i.e. for github).

Fixes #25
  • Loading branch information
kzu committed May 1, 2024
1 parent 2e8b0f4 commit 0b2682f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Devlooped;
using Spectre.Console.Cli;

Expand All @@ -16,7 +18,7 @@
{
Description = new Spectre.Console.Cli.Help.DescriptionStyle
{
Header = new Spectre.Console.Style(Spectre.Console.Color.Yellow, decoration: Spectre.Console.Decoration.Bold),
Header = new Spectre.Console.Style(Spectre.Console.Color.Yellow, decoration: Spectre.Console.Decoration.Bold),
},
Usage = new Spectre.Console.Cli.Help.UsageStyle
{
Expand Down Expand Up @@ -57,4 +59,5 @@
if (args.Length > 0 && args[0] == "store")
args[0] = "set";

await app.RunAsync(args);
// Replace --protocol > --scheme
await app.RunAsync(args.Select(x => x.StartsWith("--protocol", StringComparison.OrdinalIgnoreCase) ? x.Replace("--protocol", "--scheme") : x));

0 comments on commit 0b2682f

Please sign in to comment.