Skip to content

Commit

Permalink
Add list-features, --enable-features, & --disable-features (#93)
Browse files Browse the repository at this point in the history
* Add list-features, --enable-features, & --disable-features

* Update command description to include full name (GitHub Actions Importer)

Co-authored-by: Ethan Dennis <ethanis@github.com>

* Fix typo in enable features option

---------

Co-authored-by: Ethan Dennis <ethanis@github.com>
  • Loading branch information
Chaseshak and ethanis committed Mar 30, 2023
1 parent 90515cb commit 8d75293
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
20 changes: 19 additions & 1 deletion src/ActionsImporter/Commands/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,25 @@ public static Command AppendTransformerOptions(this Command command)
command.AddGlobalOption(
new Option<string>(new[] { "--features" })
{
Description = "Features to enable in transformed workflows."
Description = "GHES features to enable in transformed workflows."
}
);

command.AddGlobalOption(
new Option<string[]>(new[] { "--enable-features" })
{
Description = "A list of features to enable by name. Use `gh actions-importer list-features` to see available features.",
IsRequired = false,
AllowMultipleArgumentsPerToken = true
}
);

command.AddGlobalOption(
new Option<string[]>(new[] { "--disable-features" })
{
Description = "A list of features to disable by name. Use `gh actions-importer list-features` to see available features.",
IsRequired = false,
AllowMultipleArgumentsPerToken = true
}
);

Expand Down
16 changes: 16 additions & 0 deletions src/ActionsImporter/Commands/ListFeatures.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Collections.Immutable;
using System.CommandLine;

namespace ActionsImporter.Commands;

public class ListFeatures : ContainerCommand
{
public ListFeatures(string[] args) : base(args)
{
}

protected override string Name => "list-features";
protected override string Description => "List the available feature flags for GitHub Actions Importer.";

protected override ImmutableArray<Option> Options => ImmutableArray.Create<Option>();
}
3 changes: 2 additions & 1 deletion src/ActionsImporter/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
new Audit(args).Command(app),
new Forecast(args).Command(app),
new DryRun(args).Command(app),
new Migrate(args).Command(app)
new Migrate(args).Command(app),
new ListFeatures(args).Command(app)
};

var parser = new CommandLineBuilder(command)
Expand Down

0 comments on commit 8d75293

Please sign in to comment.