noz-cli/NozCli/Repl/CommandRegistry.cs
kryptomrx f45b31defa feat: graph and search API client with PS analysis cmdlets
Get-NozGraph, Find-NozNote, Measure-NozGarden, Set-NozNoteStatus,
Get-NozOrphans — graph edges, Meilisearch search, garden stats,
frontmatter status patch, orphan detection from inbound link analysis.
2026-05-17 00:27:45 +02:00

43 lines
1.1 KiB
C#

using NozCli.Commands;
namespace NozCli.Repl;
public class CommandRegistry
{
private readonly Dictionary<string, ICommand> _map;
public IReadOnlyList<ICommand> All { get; }
public CommandRegistry()
{
var list = new List<ICommand>
{
new LsCommand(),
new CdCommand(),
new CatCommand(),
new NewCommand(),
new EditCommand(),
new PushCommand(),
new SyncCommand(),
new StatusCommand(),
new RmCommand(),
new ConfigCommand(),
new TreeCommand(),
new MkdirCommand(),
new MvCommand(),
new LinkCommand(),
new TemplatesCommand(),
new VersionCommand(),
new ClearCommand(),
};
// HelpCommand gets the full list so it can print them all
list.Add(new HelpCommand(list));
All = list.AsReadOnly();
_map = list.ToDictionary(c => c.Name, StringComparer.OrdinalIgnoreCase);
}
public ICommand? Find(string name) => _map.GetValueOrDefault(name);
public IEnumerable<string> Names => _map.Keys;
}