34 lines
779 B
Go
34 lines
779 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
|
|
Execution []InputParam // TODO allow plain strings as a shorthand for PARAMTYPE_CONST
|
|
}
|
|
|
|
type AppConfig struct {
|
|
ListenAddress string
|
|
AppTitle string
|
|
Commands []CommandConfig
|
|
}
|