-
Notifications
You must be signed in to change notification settings - Fork 671
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add experimental flag to bypass arg validation (#92)
- Loading branch information
Showing
3 changed files
with
37 additions
and
3 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
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,23 @@ | ||
using System.CommandLine.Parsing; | ||
using ActionsImporter.Commands; | ||
|
||
namespace ActionsImporter.Models; | ||
|
||
public static class ParserExtensions | ||
{ | ||
public static async Task<int> InvokeAsync(this Parser? parser, App? app, string[] args, bool experimental) | ||
{ | ||
ArgumentNullException.ThrowIfNull(parser); | ||
ArgumentNullException.ThrowIfNull(app); | ||
|
||
if (experimental) | ||
{ | ||
Console.WriteLine("Experimental features are enabled. Use at your own risk."); | ||
|
||
await app.ExecuteActionsImporterAsync(args.Where(arg => !arg.Contains(Common.Experimental.Name, StringComparison.Ordinal)).ToArray()); | ||
return 0; | ||
} | ||
|
||
return await parser.InvokeAsync(args); | ||
} | ||
} |
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