mycroforge/MycroForge.CLI/Commands/MycroForge.Add.GitIgnore.cs
mdnapo 02a82589ae - Refactored init & features
- Extended documentation
2024-07-14 22:27:32 +02:00

32 lines
1019 B
C#

using System.CommandLine;
using MycroForge.CLI.Features;
using MycroForge.Core;
using MycroForge.Core.Contract;
namespace MycroForge.CLI.Commands;
public partial class MycroForge
{
public partial class Add
{
public class GitIgnore : Command, ISubCommandOf<Add>
{
private readonly ProjectContext _context;
private readonly List<IFeature> _features;
public GitIgnore(ProjectContext context, IEnumerable<IFeature> features) :
base(Features.GitIgnore.FeatureName, "Add a default .gitignore file to the project")
{
_context = context;
_features = features.ToList();
this.SetHandler(ExecuteAsync);
}
private async Task ExecuteAsync()
{
var feature = _features.First(f => f.Name == Features.GitIgnore.FeatureName);
await feature.ExecuteAsync(_context);
}
}
}
}