Skip to content

Commit

Permalink
[PoC] Add a mode that validates CLI commands/options only (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaseshak authored Jul 13, 2023
1 parent b68dcf0 commit befb118
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/ActionsImporter/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,22 @@
var parsedArguments = parser.Parse(args);
app.IsPrerelease = parsedArguments.HasOption(Common.Prerelease);

var testCommandOnly = Environment.GetEnvironmentVariable("TEST_COMMAND_ONLY");
if (testCommandOnly != null && testCommandOnly.ToUpperInvariant() == "TRUE")
{
if (parsedArguments.Errors.Count > 0)
{
foreach (var error in parsedArguments.Errors)
{
Console.WriteLine(error.Message);
}
return 1;
}

Console.WriteLine("Valid command!");
return 0;
}

try
{
if (!Array.Exists(args, x => x == "update"))
Expand Down

0 comments on commit befb118

Please sign in to comment.