2021-10-30 10:19:16 +02:00
|
|
|
package setup
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------- *
|
|
|
|
* IMPORTS
|
|
|
|
* ---------------------------------------------------------------- */
|
|
|
|
|
|
|
|
import (
|
|
|
|
"embed"
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"ads/internal/core/utils"
|
|
|
|
)
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------- *
|
|
|
|
* GLOBAL VARIABLES
|
|
|
|
* ---------------------------------------------------------------- */
|
|
|
|
|
|
|
|
var Res embed.FS
|
|
|
|
var Assets map[string]string
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------- *
|
|
|
|
* METHOD read assets
|
|
|
|
* ---------------------------------------------------------------- */
|
|
|
|
|
|
|
|
func ReadAsset(key string) string {
|
|
|
|
var found bool
|
|
|
|
if _, found = Assets[key]; !found {
|
|
|
|
log.Fatal(fmt.Sprintf("Key \033[1m%s\033[0m not found in dictionary!", key))
|
|
|
|
}
|
|
|
|
data, err := Res.ReadFile(Assets[key])
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
text := string(data)
|
|
|
|
return text
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------- *
|
2021-11-07 18:17:31 +01:00
|
|
|
* METHODS assets
|
2021-10-30 10:19:16 +02:00
|
|
|
* ---------------------------------------------------------------- */
|
|
|
|
|
|
|
|
func Help() string {
|
|
|
|
contents := ReadAsset("help")
|
|
|
|
return utils.DedentAndExpand(contents)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Logo() string {
|
|
|
|
contents := ReadAsset("logo")
|
|
|
|
return utils.DedentAndExpand(contents)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Version() string {
|
|
|
|
return strings.Trim(ReadAsset("version"), "\n")
|
|
|
|
}
|
2021-11-02 09:07:04 +01:00
|
|
|
|
|
|
|
func AppConfigYaml() string {
|
|
|
|
return strings.Trim(ReadAsset("appconfig"), "\n")
|
|
|
|
}
|