拆分代码5

This commit is contained in:
2026-02-04 20:42:11 +08:00
parent 3cc6d2c92a
commit 73530c6ba3
3 changed files with 54 additions and 30 deletions

View File

@@ -0,0 +1,26 @@
using System;
namespace CMLeonOS.Commands.Editor
{
public static class EditCommand
{
public static void EditFile(string fileName, CMLeonOS.FileSystem fileSystem, Action<string> showError)
{
if (string.IsNullOrEmpty(fileName))
{
showError("Please specify a file name");
return;
}
try
{
var editor = new CMLeonOS.Editor(fileName, fileSystem);
editor.Run();
}
catch (Exception ex)
{
showError($"Error starting editor: {ex.Message}");
}
}
}
}