Skip to content
Snippets Groups Projects
Verified Commit 4e2ab573 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

feat: add verbose flag and fix text infos

parent 1a732807
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,8 @@ import (
)
type Definition struct {
Help struct {
Verbose bool `short:"v" long:"verbose" description:"Show verbose debug information"`
Help struct {
} `command:"help" call:"PrintHelp" description:"Prints this help message"`
Template struct {
Prepare struct {
......
......@@ -2,6 +2,7 @@ package main
import (
"fmt"
"github.com/charmbracelet/log"
xflags "gitlab.schukai.com/oss/libraries/go/application/xflags.git"
"os"
......@@ -14,8 +15,16 @@ func main() {
definition := Definition{}
definition.Template.Prepare.DataFile = "data.yaml"
logger := log.Default()
logger.SetLevel(log.ErrorLevel)
settings = xflags.New(os.Args[0], definition)
settings.Parse(os.Args[1:])
if settings.GetValues().Verbose {
logger.SetLevel(log.DebugLevel)
}
settings.Execute()
if settings.HasErrors() {
......
......@@ -413,6 +413,7 @@ func removeDuplicateWhitespaces(str string) string {
func handleTextNode(n *html.Node, storage *types.PageData) {
content := strings.TrimSpace(n.Data)
if content == "" {
return
}
......@@ -425,6 +426,15 @@ func handleTextNode(n *html.Node, storage *types.PageData) {
// if span and has constants.DataBobReferenceAttributeKey, ignore
if n.Parent.Data == "span" && util.HasAttribute(n.Parent.Attr, constants.DataBobReferenceAttributeKey) {
id := util.GetAttribute(n.Parent.Attr, constants.DataBobReferenceAttributeKey)
log.Info("Added text: " + id + " (" + logContent + ") to storage")
storage.Text = append(storage.Text, types.Text{
Id: id,
Text: content,
})
return
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment