MCPcopy Create free account
hub / github.com/astercloud/aster / limitLines

Method limitLines

pkg/tools/builtin/task_manager.go:589–600  ·  view source on GitHub ↗

limitLines 限制行数

(output string, maxLines int)

Source from the content-addressed store, hash-verified

587
588// limitLines 限制行数
589func (tm *FileTaskManager) limitLines(output string, maxLines int) string {
590 if maxLines <= 0 || output == "" {
591 return output
592 }
593
594 lines := strings.Split(output, "\n")
595 if len(lines) <= maxLines {
596 return output
597 }
598
599 return strings.Join(lines[len(lines)-maxLines:], "\n")
600}
601
602// 全局任务管理器实例
603var GlobalTaskManager TaskManager

Callers 1

GetTaskOutputMethod · 0.95

Calls 1

JoinMethod · 0.45

Tested by

no test coverage detected