chore: 移除调试子命令 acttest/wttest
This commit is contained in:
@@ -99,59 +99,6 @@ public static class CliRunner
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 仅用于自测:acttest <hwnd>,尝试激活指定窗口并把结果写入临时日志
|
||||
public static int ActTest(string[] args)
|
||||
{
|
||||
if (args.Length < 2 || !long.TryParse(args[1], out var h))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
var before = Win32.GetForegroundWindow().ToInt64();
|
||||
var ok = WindowActivator.Activate(new IntPtr(h));
|
||||
var after = Win32.GetForegroundWindow().ToInt64();
|
||||
|
||||
try
|
||||
{
|
||||
System.IO.File.WriteAllText(
|
||||
System.IO.Path.Combine(System.IO.Path.GetTempPath(), "notify-acttest.log"),
|
||||
$"target={h} before={before} after={after} ok={ok}\n");
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 忽略
|
||||
}
|
||||
|
||||
return ok ? 0 : 1;
|
||||
}
|
||||
|
||||
// 仅用于自测:wttest <hwnd> <runtimeId>,切到该标签后回读当前选中项
|
||||
public static int WtTest(string[] args)
|
||||
{
|
||||
if (args.Length < 3 || !long.TryParse(args[1], out var h))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
var hwnd = new IntPtr(h);
|
||||
var ok = WinTerminalTabs.SelectTab(hwnd, args[2]);
|
||||
System.Threading.Thread.Sleep(250);
|
||||
var now = WinTerminalTabs.GetSelectedTabRuntimeId(hwnd);
|
||||
|
||||
try
|
||||
{
|
||||
System.IO.File.WriteAllText(
|
||||
System.IO.Path.Combine(System.IO.Path.GetTempPath(), "notify-wttest.log"),
|
||||
$"select ok={ok} expected={args[2]} nowSelected={now} match={(now == args[2])}\n");
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 忽略
|
||||
}
|
||||
|
||||
return ok ? 0 : 1;
|
||||
}
|
||||
|
||||
// SessionEnd:清理会话状态
|
||||
public static int Cleanup()
|
||||
{
|
||||
|
||||
@@ -31,8 +31,6 @@ internal static class Program
|
||||
"notify" => CliRunner.Notify(),
|
||||
"input" => CliRunner.Input(),
|
||||
"cleanup" => CliRunner.Cleanup(),
|
||||
"acttest" => CliRunner.ActTest(args),
|
||||
"wttest" => CliRunner.WtTest(args),
|
||||
_ => RunHost(args),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user