refactor(cli): trim internal command exports (#106426)

This commit is contained in:
Peter Steinberger
2026-07-13 06:47:02 -07:00
committed by GitHub
parent 0ff265838b
commit a965d28e04
14 changed files with 22 additions and 130 deletions
+1 -18
View File
@@ -1,26 +1,9 @@
// Command tree tests cover CLI command hierarchy construction and lookup.
import { Command } from "commander";
import { describe, expect, it } from "vitest";
import { removeCommand, removeCommandByName } from "./command-tree.js";
import { removeCommandByName } from "./command-tree.js";
describe("command-tree", () => {
it("removes a command instance when present", () => {
const program = new Command();
const alpha = program.command("alpha");
program.command("beta");
expect(removeCommand(program, alpha)).toBe(true);
expect(program.commands.map((command) => command.name())).toEqual(["beta"]);
});
it("returns false when command instance is already absent", () => {
const program = new Command();
program.command("alpha");
const detached = new Command("beta");
expect(removeCommand(program, detached)).toBe(false);
});
it("removes by command name", () => {
const program = new Command();
program.command("alpha");