32 lines
917 B
C#
32 lines
917 B
C#
using System.CommandLine;
|
|
using MycroForge.CLI.Commands.Interfaces;
|
|
|
|
namespace MycroForge.CLI.Commands;
|
|
|
|
public partial class MycroForge
|
|
{
|
|
public partial class Script
|
|
{
|
|
public class List : Command, ISubCommandOf<Script>
|
|
{
|
|
public List() : base("list", "Show available scripts")
|
|
{
|
|
this.SetHandler(Execute);
|
|
}
|
|
|
|
private void Execute()
|
|
{
|
|
var folder = Path.Combine(
|
|
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".m4g"
|
|
);
|
|
|
|
var files = Directory.GetFiles(folder)
|
|
.Select(Path.GetFileName)
|
|
.Select(p => p.Replace(".py", ""));
|
|
|
|
foreach (var file in files)
|
|
Console.WriteLine(file);
|
|
}
|
|
}
|
|
}
|
|
} |