Commit 22456237 authored by 马旭烽's avatar 马旭烽

🐞 fix: 修复 commander 子命令错误

原逻辑一个 program 只能具备一个 action 导致逻辑被覆盖
parent 058def7e
......@@ -6,5 +6,9 @@ export interface useProgramType<CTX> {
/** 注册程序执行函数 */
export const registerUseProgram =<CTX>(program: Command, usePrograms: useProgramType<CTX>[], ctx: CTX ): Command => {
return usePrograms.reduce((program, useProgram) => useProgram(program, ctx), program);
return usePrograms.reduce((program, useProgram, id) => {
const command = new Command('server' + id);
program.addCommand(useProgram(command, ctx));
return program;
}, program);
};
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment