2021-11-03 11:04:59 +01:00
|
|
|
package menus
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------- *
|
|
|
|
* IMPORTS
|
|
|
|
* ---------------------------------------------------------------- */
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------- *
|
|
|
|
* TYPES
|
|
|
|
* ---------------------------------------------------------------- */
|
|
|
|
|
|
|
|
type MenuOption struct {
|
|
|
|
Label string
|
|
|
|
SubLabel string
|
|
|
|
Submenu *Menu
|
2021-11-03 16:05:46 +01:00
|
|
|
Action func() (bool, error) // NOTE: in go, this is automatically a pointer type
|
2021-11-03 11:04:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type Menu struct {
|
|
|
|
IsRoot bool
|
|
|
|
Path []string
|
|
|
|
PromptMessages []string
|
|
|
|
Options []MenuOption
|
|
|
|
DefaultOption int
|
|
|
|
}
|
2021-11-03 16:05:46 +01:00
|
|
|
|
|
|
|
/* ---------------------------------------------------------------- *
|
|
|
|
* TYPES - prompt
|
|
|
|
* ---------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/*
|
|
|
|
Usage
|
|
|
|
|
|
|
|
- Name: Variablenname
|
|
|
|
|
|
|
|
- Description: Kurze Beschreibung der Variablen
|
|
|
|
|
|
|
|
- Type: Beschreiben des erwarteten Types der Variablen.
|
|
|
|
|
|
|
|
- Requirements: Liste von Anforderungen.
|
|
|
|
|
|
|
|
- Response: Ptr zur Struct, d. h. &responseType{}, wobei responseType eine struct der folgenden Form ist:
|
|
|
|
|
|
|
|
type responseType struct { Response #### `yaml:"response"` }
|
|
|
|
|
|
|
|
wobei #### = ein Typ
|
|
|
|
*/
|
|
|
|
type PromptValueQuery struct {
|
|
|
|
Name string
|
|
|
|
Description string
|
|
|
|
Type string
|
|
|
|
ValidExamples *[]string
|
|
|
|
Requirements *[]string
|
|
|
|
// Response muss ein Ptr auf eine Struct sein:
|
|
|
|
Response interface{}
|
|
|
|
}
|