Fixes to commands where (sub)commands never extend pkl:Command (#1882)

This commit is contained in:
Jen Basch authored and GitHub committed 2026-09-29 23:19:28 +00:00
1 parent e83d8fa14b
commit 1271da2741
6 files changed
+185 -23

No files matched your search

+6 -3
View File
@@ -36,12 +36,15 @@ import "pkl:Command"
import "pkl:reflect"
local commandClass = reflect.Class(getClass())
local commandModule = reflect.Module(Command)
/// Command configuration.
hidden command: CommandInfo = new {
name = // choose the name of the module if the command is a module or the class otherwise
if (commandClass.name == "ModuleClass") reflect.Module(module).name else commandClass.name
description = commandClass.docComment // works for both classes and module classes
when (commandClass != commandModule.moduleClass) {
name =
if (commandClass.name == "ModuleClass") reflect.moduleOf(module).name else commandClass.name
description = commandClass.docComment
}
}
/// Command line options.