webcmd: MaxHistoryLines
This commit is contained in:
parent
d0fed6e4cf
commit
7dde122d9b
3
Task.go
3
Task.go
@ -85,6 +85,9 @@ func (this *App) LaunchTask(params []string) (taskRef string, err error) {
|
|||||||
|
|
||||||
task := this.tasks[ref]
|
task := this.tasks[ref]
|
||||||
task.output = append(task.output, OutputLine{isError: isError, text: text})
|
task.output = append(task.output, OutputLine{isError: isError, text: text})
|
||||||
|
if len(task.output) > 2*this.cfg.MaxHistoryLines {
|
||||||
|
task.output = task.output[this.cfg.MaxHistoryLines:]
|
||||||
|
}
|
||||||
this.tasks[ref] = task
|
this.tasks[ref] = task
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
"ListenAddress": ":8192",
|
"ListenAddress": ":8192",
|
||||||
|
|
||||||
|
"MaxHistoryLines": 100,
|
||||||
|
|
||||||
"Commands": [
|
"Commands": [
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,8 @@ type CommandConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AppConfig struct {
|
type AppConfig struct {
|
||||||
ListenAddress string
|
ListenAddress string
|
||||||
AppTitle string
|
AppTitle string
|
||||||
Commands []CommandConfig
|
MaxHistoryLines int // default zero: unlimited history for each command
|
||||||
|
Commands []CommandConfig
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user