2017-03-25 02:41:36 +00:00
|
|
|
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
|
|
|
|
Execution []InputParam // TODO allow plain strings as a shorthand for PARAMTYPE_CONST
|
|
|
|
}
|
|
|
|
|
|
|
|
type AppConfig struct {
|
2017-03-25 02:55:48 +00:00
|
|
|
ListenAddress string
|
|
|
|
AppTitle string
|
|
|
|
MaxHistoryLines int // default zero: unlimited history for each command
|
|
|
|
Commands []CommandConfig
|
2017-03-25 02:41:36 +00:00
|
|
|
}
|