webcmd/config.go

36 lines
919 B
Go

package webcmd
type ParamType int
const (
PARAMTYPE_CONST ParamType = 0
PARAMTYPE_STRING ParamType = 1
PARAMTYPE_OPTIONAL ParamType = 2
// bool 1/0
// list
// k/v list
// file upload (temporary path passed to binary)
// nested parse subgroup (e.g. ffmpeg filters)
// one optional to control a whole subgroup (e.g. --timeout 4)
// String validations (regexp, min-length, ...)
)
type InputParam struct {
Description string `json:",omitempty"` // only use for editable parameters
ParamType ParamType
Value string
}
type CommandConfig struct {
Title string
WorkingDir string // default empty-string: getcwd()
Execution []InputParam // TODO allow plain strings as a shorthand for PARAMTYPE_CONST
}
type AppConfig struct {
ListenAddress string
AppTitle string
MaxHistoryLines int // default zero: unlimited history for each command
Commands []CommandConfig
}