You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2022/08/03 11:05:17 UTC
[plc4x] branch develop updated: refactor(plc4xbrowser): reworked the REPL command system
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/develop by this push:
new 6858376df refactor(plc4xbrowser): reworked the REPL command system
6858376df is described below
commit 6858376df9571a5c8c131bab7096d81e74146f8e
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Aug 3 13:05:09 2022 +0200
refactor(plc4xbrowser): reworked the REPL command system
---
plc4go/tools/plc4xbrowser/commands.go | 412 ++++++++++++++++++++++++++++++++++
plc4go/tools/plc4xbrowser/main.go | 185 +--------------
2 files changed, 419 insertions(+), 178 deletions(-)
diff --git a/plc4go/tools/plc4xbrowser/commands.go b/plc4go/tools/plc4xbrowser/commands.go
new file mode 100644
index 000000000..b8501ecdd
--- /dev/null
+++ b/plc4go/tools/plc4xbrowser/commands.go
@@ -0,0 +1,412 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package main
+
+import (
+ "fmt"
+ "github.com/apache/plc4x/plc4go/internal/ads"
+ "github.com/apache/plc4x/plc4go/internal/bacnetip"
+ "github.com/apache/plc4x/plc4go/internal/cbus"
+ "github.com/apache/plc4x/plc4go/internal/s7"
+ plc4x_config "github.com/apache/plc4x/plc4go/pkg/api/config"
+ "github.com/apache/plc4x/plc4go/pkg/api/model"
+ "github.com/apache/plc4x/plc4go/pkg/api/transports"
+ "github.com/pkg/errors"
+ "github.com/rs/zerolog"
+ "github.com/rs/zerolog/log"
+ "net/url"
+ "strings"
+)
+
+const rootCommandIndicator = "rootCommand"
+
+const protocols = "ads,bacnetip,c-bus,s7"
+
+var protocolsSuggestions = strings.Split(protocols, ",")
+
+var rootCommand Command = Command{
+ Name: rootCommandIndicator,
+ subCommands: []Command{
+ {
+ Name: "connect",
+ Description: "Connects to a device",
+ action: func(_ Command, connectionString string) error {
+ log.Info().Msgf("connect connectionString [%s]", connectionString)
+ connectionUrl, err := url.Parse(connectionString)
+ if err != nil {
+ return errors.Wrapf(err, "can't parse connection url %s", connectionString)
+ }
+ addHost(connectionUrl.Host)
+ connectionId := fmt.Sprintf("%s://%s", connectionUrl.Scheme, connectionUrl.Host)
+ if _, ok := connections[connectionId]; ok {
+ return errors.Errorf("%s already connected", connectionId)
+ }
+ connectionResult := <-driverManager.GetConnection(connectionString)
+ if err := connectionResult.GetErr(); err != nil {
+ return errors.Wrapf(err, "%s can't connect to", connectionUrl.Host)
+ }
+ log.Info().Msgf("%s connected", connectionId)
+ connections[connectionId] = connectionResult.GetConnection()
+ connectionsChanged()
+ return nil
+ },
+ parameterSuggestions: func(currentText string) (entries []string) {
+ for _, protocol := range protocolsSuggestions {
+ if strings.HasPrefix(currentText, protocol) {
+ for _, host := range config.History.Last10Hosts {
+ entries = append(entries, protocol+"://"+host)
+ }
+ entries = append(entries, currentText)
+ } else {
+ entries = append(entries, protocol)
+ }
+ }
+ return
+ },
+ },
+ {
+ Name: "disconnect",
+ Description: "Disconnect a connection",
+ action: func(_ Command, connectionString string) error {
+ if connection, ok := connections[connectionString]; !ok {
+ return errors.Errorf("%s not connected", connectionString)
+ } else {
+ closeResult := <-connection.Close()
+ log.Info().Msgf("%s disconnected", connectionString)
+ delete(connections, connectionString)
+ connectionsChanged()
+ if err := closeResult.GetErr(); err != nil {
+ return errors.Wrapf(err, "%s can't close", connectionString)
+ }
+ }
+ return nil
+ },
+ parameterSuggestions: func(currentText string) (entries []string) {
+ for connectionsString, _ := range connections {
+ entries = append(entries, connectionsString)
+ }
+ return
+ },
+ },
+ {
+ Name: "read",
+ },
+ {
+ Name: "write",
+ },
+ {
+ Name: "register",
+ Description: "register a driver in the subsystem",
+ action: func(_ Command, protocol string) error {
+ switch protocol {
+ case "ads":
+ driverManager.RegisterDriver(ads.NewDriver())
+ transports.RegisterTcpTransport(driverManager)
+ case "bacnetip":
+ driverManager.RegisterDriver(bacnetip.NewDriver())
+ transports.RegisterUdpTransport(driverManager)
+ case "c-bus":
+ driverManager.RegisterDriver(cbus.NewDriver())
+ transports.RegisterTcpTransport(driverManager)
+ case "s7":
+ driverManager.RegisterDriver(s7.NewDriver())
+ transports.RegisterTcpTransport(driverManager)
+ default:
+ return errors.Errorf("Unknown protocol %s", protocol)
+ }
+ driverAdded(protocol)
+ return nil
+ },
+ parameterSuggestions: func(currentText string) (entries []string) {
+ for _, protocol := range protocolsSuggestions {
+ if strings.HasPrefix(protocol, currentText) {
+ entries = append(entries, protocol)
+ }
+ }
+ return
+ },
+ },
+ {
+ Name: "subscribe",
+ Description: "Starts a subscription request",
+ action: func(_ Command, connectionsString string) error {
+ if connection, ok := connections[connectionsString]; !ok {
+ return errors.Errorf("%s not connected", connectionsString)
+ } else {
+ // TODO: hardcoded to c-bus at the moment
+ subscriptionRequest, err := connection.SubscriptionRequestBuilder().
+ AddEventQuery("something", "monitor/*/*").
+ AddItemHandler(func(event model.PlcSubscriptionEvent) {
+ messagesReceived++
+ _, _ = fmt.Fprintf(messageOutput, "[\"%d\"]\n%s[\"\"]", messagesReceived, event)
+ }).
+ Build()
+ if err != nil {
+ return errors.Wrapf(err, "%s can't subscribe", connectionsString)
+ }
+ subscriptionRequestResult := <-subscriptionRequest.Execute()
+ if err := subscriptionRequestResult.GetErr(); err != nil {
+ return errors.Wrapf(err, "%s can't subscribe", connectionsString)
+ }
+ log.Info().Msgf("subscription result %s", subscriptionRequestResult.GetResponse())
+ }
+ return nil
+ },
+ parameterSuggestions: func(currentText string) (entries []string) {
+ for connectionsString, _ := range connections {
+ entries = append(entries, connectionsString)
+ }
+ return
+ },
+ },
+ {
+ Name: "quit",
+ Description: "Quits the application",
+ },
+ {
+ Name: "log",
+ Description: "Log related operations",
+ subCommands: []Command{
+ {
+ Name: "get",
+ Description: "Get a log level",
+ action: func(_ Command, _ string) error {
+ _, _ = fmt.Fprintf(commandOutput, "Current log level %s", log.Logger.GetLevel())
+ return nil
+ },
+ },
+ {
+ Name: "set",
+ Description: "Sets a log level",
+ action: func(_ Command, level string) error {
+ parseLevel, err := zerolog.ParseLevel(level)
+ if err != nil {
+ return errors.Wrapf(err, "Error setting log level")
+ }
+ setLevel(parseLevel)
+ log.Logger = log.Logger.Level(parseLevel)
+ return nil
+ },
+ parameterSuggestions: func(currentText string) (entries []string) {
+ levels := []string{
+ zerolog.LevelTraceValue,
+ zerolog.LevelDebugValue,
+ zerolog.LevelInfoValue,
+ zerolog.LevelWarnValue,
+ zerolog.LevelErrorValue,
+ zerolog.LevelFatalValue,
+ zerolog.LevelPanicValue,
+ }
+ for _, level := range levels {
+ entries = append(entries, level)
+ }
+ return
+ },
+ },
+ },
+ },
+ {
+ Name: "plc4x-conf",
+ Description: "plc4x related settings",
+ subCommands: []Command{
+ {
+ Name: "TraceTransactionManagerWorkers",
+ action: func(_ Command, argument string) error {
+ switch argument {
+ case "on":
+ plc4x_config.TraceTransactionManagerWorkers = true
+ case "off":
+ plc4x_config.TraceTransactionManagerWorkers = false
+ default:
+ return errors.Errorf("illegal argument %s", argument)
+ }
+ return nil
+ },
+ parameterSuggestions: func(currentText string) (entries []string) {
+ entries = append(entries, "on", "off")
+ return
+ },
+ },
+ {
+ Name: "TraceTransactionManagerTransactions",
+ action: func(_ Command, argument string) error {
+ switch argument {
+ case "on":
+ plc4x_config.TraceTransactionManagerTransactions = true
+ case "off":
+ plc4x_config.TraceTransactionManagerTransactions = false
+ default:
+ return errors.Errorf("illegal argument %s", argument)
+ }
+ return nil
+ },
+ parameterSuggestions: func(currentText string) (entries []string) {
+ entries = append(entries, "on", "off")
+ return
+ },
+ },
+ {
+ Name: "TraceDefaultMessageCodecWorker",
+ action: func(_ Command, argument string) error {
+ switch argument {
+ case "on":
+ plc4x_config.TraceDefaultMessageCodecWorker = true
+ case "off":
+ plc4x_config.TraceDefaultMessageCodecWorker = false
+ default:
+ return errors.Errorf("illegal argument %s", argument)
+ }
+ return nil
+ },
+ parameterSuggestions: func(currentText string) (entries []string) {
+ entries = append(entries, "on", "off")
+ return
+ },
+ },
+ },
+ },
+ },
+}
+
+func init() {
+ // Because of the cycle we need to define the help command here as it needs access to the to command
+ rootCommand.subCommands = append(rootCommand.subCommands, Command{
+ Name: "help",
+ Description: "prints out this help",
+ action: func(_ Command, _ string) error {
+ _, _ = fmt.Fprintf(commandOutput, "Available commands\n")
+ rootCommand.visit(0, func(currentIndent int, command Command) {
+ indentString := strings.Repeat(" ", currentIndent)
+ _, _ = fmt.Fprintf(commandOutput, "%s [#00ff00]%s[white]: %s\n", indentString, command.Name, command.Description)
+ })
+ return nil
+ },
+ })
+}
+
+var NotDirectlyExecutable = errors.New("Not directly executable")
+
+type Command struct {
+ Name string
+ Description string
+ action func(currentCommand Command, argument string) error
+ subCommands []Command
+ parameterSuggestions func(currentText string) (entries []string)
+}
+
+func (c Command) Completions(currentCommandText string) (entries []string) {
+ if c.Name == rootCommandIndicator && len(currentCommandText) == 0 {
+ // We don't return anything here to not pollute the command text by default
+ return
+ }
+ if c.acceptsCurrentText(currentCommandText) {
+ currentCommandPrefix := c.currentCommandPrefix()
+ doesCommandTextTargetSubCommand := c.doesCommandTextTargetSubCommand(currentCommandPrefix)
+ if c.hasDirectExecution() && !doesCommandTextTargetSubCommand {
+ if c.parameterSuggestions != nil {
+ preparedForParameters := c.prepareForParameters(currentCommandText)
+ for _, parameterSuggestion := range c.parameterSuggestions(preparedForParameters) {
+ entries = append(entries, currentCommandPrefix+parameterSuggestion)
+ }
+ } else {
+ entries = append(entries, c.Name)
+ }
+ }
+ if doesCommandTextTargetSubCommand {
+ remainder := c.prepareForSubCommand(currentCommandText)
+ for _, command := range c.subCommands {
+ for _, subCommandCompletions := range command.Completions(remainder) {
+ entries = append(entries, currentCommandPrefix+subCommandCompletions)
+ }
+ }
+ }
+ } else if strings.HasPrefix(c.Name, currentCommandText) {
+ // Suggest ourselves if we start with the current letter
+ entries = append(entries, c.Name)
+ }
+ return
+}
+
+func (c Command) acceptsCurrentText(currentCommandText string) bool {
+ if c.Name == rootCommandIndicator {
+ return true
+ }
+ return strings.HasPrefix(currentCommandText, c.Name)
+}
+
+func (c Command) doesCommandTextTargetSubCommand(currentCommandText string) bool {
+ if c.Name == rootCommandIndicator {
+ return true
+ }
+ if len(c.subCommands) == 0 {
+ return false
+ }
+ return strings.HasPrefix(currentCommandText, c.currentCommandPrefix())
+}
+
+func (c Command) prepareForParameters(currentCommandText string) string {
+ return strings.TrimPrefix(currentCommandText, c.currentCommandPrefix())
+}
+func (c Command) prepareForSubCommand(currentCommandText string) string {
+ return strings.TrimPrefix(currentCommandText, c.currentCommandPrefix())
+}
+
+func (c Command) currentCommandPrefix() string {
+ if c.Name == rootCommandIndicator {
+ return ""
+ }
+ return c.Name + " "
+}
+
+func (c Command) hasDirectExecution() bool {
+ return c.action != nil
+}
+
+func Execute(commandText string) error {
+ return rootCommand.Execute(commandText)
+}
+
+func (c Command) Execute(commandText string) error {
+ if !c.acceptsCurrentText(commandText) {
+ return errors.Errorf("%s doesn't understand %s", c.Name, commandText)
+ }
+ if c.doesCommandTextTargetSubCommand(commandText) {
+ prepareForSubCommandForSubCommand := c.prepareForSubCommand(commandText)
+ for _, command := range c.subCommands {
+ if command.acceptsCurrentText(prepareForSubCommandForSubCommand) {
+ return command.Execute(prepareForSubCommandForSubCommand)
+ }
+ }
+ return errors.Errorf("%s not accepted by any subcommands of %s", commandText, c.Name)
+ } else {
+ if c.action == nil {
+ return NotDirectlyExecutable
+ }
+ preparedForParameters := c.prepareForParameters(commandText)
+ return c.action(c, preparedForParameters)
+ }
+}
+
+func (c Command) visit(i int, f func(currentIndent int, command Command)) {
+ f(i, c)
+ for _, subCommand := range c.subCommands {
+ f(i+1, subCommand)
+ }
+}
diff --git a/plc4go/tools/plc4xbrowser/main.go b/plc4go/tools/plc4xbrowser/main.go
index a2e919ebd..7f854f8fb 100644
--- a/plc4go/tools/plc4xbrowser/main.go
+++ b/plc4go/tools/plc4xbrowser/main.go
@@ -21,33 +21,19 @@ package main
import (
"fmt"
- "github.com/apache/plc4x/plc4go/internal/ads"
- "github.com/apache/plc4x/plc4go/internal/bacnetip"
- "github.com/apache/plc4x/plc4go/internal/cbus"
- "github.com/apache/plc4x/plc4go/internal/s7"
"io"
- "net/url"
"strconv"
- "strings"
"sync"
"time"
"github.com/gdamore/tcell/v2"
- "github.com/pkg/errors"
"github.com/rivo/tview"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
plc4go "github.com/apache/plc4x/plc4go/pkg/api"
- plc4x_config "github.com/apache/plc4x/plc4go/pkg/api/config"
- "github.com/apache/plc4x/plc4go/pkg/api/model"
- "github.com/apache/plc4x/plc4go/pkg/api/transports"
)
-// TODO: replace with real commands
-const plc4xCommands = "connect,disconnect,read,write,register,subscribe,quit,log,plc4x-conf"
-const protocols = "ads,bacnetip,c-bus,s7"
-
var driverManager plc4go.PlcDriverManager
var driverAdded func(string)
var connections map[string]plc4go.PlcConnection
@@ -60,6 +46,8 @@ var messageOutput io.Writer
var consoleOutput io.Writer
+var commandOutput io.Writer
+
func init() {
hasShutdown = false
connections = make(map[string]plc4go.PlcConnection)
@@ -207,12 +195,12 @@ func buildCommandArea(newPrimitive func(text string) tview.Primitive, applicatio
SetChangedFunc(func() {
application.Draw()
})
+ commandOutput = enteredCommands
+
commandArea.AddItem(enteredCommands, 1, 0, 1, 1, 0, 0, false)
- plc4xCommandSuggestions := strings.Split(plc4xCommands, ",")
- protocolsSuggestions := strings.Split(protocols, ",")
commandInputField := tview.NewInputField().
- SetLabel("PLC4X Command").
+ SetLabel("$").
SetFieldWidth(30)
commandInputField.
SetDoneFunc(func(key tcell.Key) {
@@ -225,7 +213,7 @@ func buildCommandArea(newPrimitive func(text string) tview.Primitive, applicatio
commandsExecuted++
_, _ = fmt.Fprintf(enteredCommands, "%s [\"%d\"]%s[\"\"]\n", time.Now().Format("04:05"), commandsExecuted, commandText)
go func() {
- if err := handleCommand(commandText); err != nil {
+ if err := Execute(commandText); err != nil {
_, _ = fmt.Fprintf(enteredCommands, "[#ff0000]%s %s[white]\n", time.Now().Format("04:05"), err)
return
}
@@ -234,171 +222,12 @@ func buildCommandArea(newPrimitive func(text string) tview.Primitive, applicatio
})
}()
})
- commandInputField.SetAutocompleteFunc(func(currentText string) (entries []string) {
- if len(currentText) == 0 {
- return
- }
- for _, word := range plc4xCommandSuggestions {
- if strings.HasPrefix(strings.ToLower(word), strings.ToLower(currentText)) {
- entries = append(entries, word)
- }
- }
- switch {
- case strings.HasPrefix(currentText, "connect"):
- for _, protocol := range protocolsSuggestions {
- if strings.HasPrefix(currentText, "connect "+protocol) {
- for _, host := range config.History.Last10Hosts {
- entries = append(entries, "connect "+protocol+"://"+host)
- }
- entries = append(entries, currentText)
- } else {
- entries = append(entries, "connect "+protocol)
- }
- }
- case strings.HasPrefix(currentText, "disconnect"):
- for connectionsString, _ := range connections {
- entries = append(entries, "disconnect "+connectionsString)
- }
- case strings.HasPrefix(currentText, "register"):
- for _, protocol := range protocolsSuggestions {
- entries = append(entries, "register "+protocol)
- }
- case strings.HasPrefix(currentText, "subscribe"):
- for connectionsString, _ := range connections {
- entries = append(entries, "subscribe "+connectionsString)
- }
- case strings.HasPrefix(currentText, "log"):
- levels := []string{
- zerolog.LevelTraceValue,
- zerolog.LevelDebugValue,
- zerolog.LevelInfoValue,
- zerolog.LevelWarnValue,
- zerolog.LevelErrorValue,
- zerolog.LevelFatalValue,
- zerolog.LevelPanicValue,
- }
- for _, level := range levels {
- entries = append(entries, "log "+level)
- }
- case strings.HasPrefix(currentText, "plc4x-conf"):
- for _, plc4xConf := range []string{
- "TraceTransactionManagerWorkers",
- "TraceTransactionManagerTransactions",
- "TraceDefaultMessageCodecWorker",
- } {
- entries = append(entries, "plc4x-conf "+plc4xConf+" true")
- entries = append(entries, "plc4x-conf "+plc4xConf+" false")
- }
- }
- return
- })
+ commandInputField.SetAutocompleteFunc(rootCommand.Completions)
commandArea.AddItem(commandInputField, 2, 0, 1, 1, 0, 0, true)
}
return commandArea
}
-func handleCommand(commandText string) error {
- switch {
- case strings.HasPrefix(commandText, "register "):
- protocol := strings.TrimPrefix(commandText, "register ")
- switch protocol {
- case "ads":
- driverManager.RegisterDriver(ads.NewDriver())
- transports.RegisterTcpTransport(driverManager)
- case "bacnetip":
- driverManager.RegisterDriver(bacnetip.NewDriver())
- transports.RegisterUdpTransport(driverManager)
- case "c-bus":
- driverManager.RegisterDriver(cbus.NewDriver())
- transports.RegisterTcpTransport(driverManager)
- case "s7":
- driverManager.RegisterDriver(s7.NewDriver())
- transports.RegisterTcpTransport(driverManager)
- default:
- return errors.Errorf("Unknown protocol %s", protocol)
- }
- driverAdded(protocol)
- case strings.HasPrefix(commandText, "connect "):
- connectionString := strings.TrimPrefix(commandText, "connect ")
- log.Info().Msgf("commandText [%s] connectionString [%s]", commandText, connectionString)
- connectionUrl, err := url.Parse(connectionString)
- if err != nil {
- return errors.Wrapf(err, "can't parse connection url %s", connectionString)
- }
- addHost(connectionUrl.Host)
- connectionId := fmt.Sprintf("%s://%s", connectionUrl.Scheme, connectionUrl.Host)
- if _, ok := connections[connectionId]; ok {
- return errors.Errorf("%s already connected", connectionId)
- }
- connectionResult := <-driverManager.GetConnection(connectionString)
- if err := connectionResult.GetErr(); err != nil {
- return errors.Wrapf(err, "%s can't connect to", connectionUrl.Host)
- }
- log.Info().Msgf("%s connected", connectionId)
- connections[connectionId] = connectionResult.GetConnection()
- connectionsChanged()
- case strings.HasPrefix(commandText, "disconnect "):
- host := strings.TrimPrefix(commandText, "disconnect ")
- if connection, ok := connections[host]; !ok {
- return errors.Errorf("%s not connected", host)
- } else {
- closeResult := <-connection.Close()
- log.Info().Msgf("%s disconnected", host)
- delete(connections, host)
- connectionsChanged()
- if err := closeResult.GetErr(); err != nil {
- return errors.Wrapf(err, "%s can't close", host)
- }
- }
- case strings.HasPrefix(commandText, "subscribe "):
- host := strings.TrimPrefix(commandText, "subscribe ")
- if connection, ok := connections[host]; !ok {
- return errors.Errorf("%s not connected", host)
- } else {
- // TODO: hardcoded to c-bus at the moment
- subscriptionRequest, err := connection.SubscriptionRequestBuilder().
- AddEventQuery("something", "monitor/*/*").
- AddItemHandler(func(event model.PlcSubscriptionEvent) {
- messagesReceived++
- _, _ = fmt.Fprintf(messageOutput, "[\"%d\"]\n%s[\"\"]", messagesReceived, event)
- }).
- Build()
- if err != nil {
- return errors.Wrapf(err, "%s can't subscribe", host)
- }
- subscriptionRequestResult := <-subscriptionRequest.Execute()
- if err := subscriptionRequestResult.GetErr(); err != nil {
- return errors.Wrapf(err, "%s can't subscribe", host)
- }
- log.Info().Msgf("subscription result %s", subscriptionRequestResult.GetResponse())
- }
- case strings.HasPrefix(commandText, "log"):
- level := strings.TrimPrefix(commandText, "log ")
- parseLevel, err := zerolog.ParseLevel(level)
- if err != nil {
- return errors.Wrapf(err, "Error setting log level")
- }
- setLevel(parseLevel)
- log.Logger = log.Logger.Level(parseLevel)
- case strings.HasPrefix(commandText, "plc4x-conf"):
- plc4xConf := strings.TrimPrefix(commandText, "plc4x-conf ")
- switch {
- case strings.HasPrefix(plc4xConf, "TraceTransactionManagerWorkers "):
- on := strings.TrimPrefix(plc4xConf, "TraceTransactionManagerWorkers ")
- plc4x_config.TraceTransactionManagerWorkers = on == "true"
- case strings.HasPrefix(plc4xConf, "TraceTransactionManagerTransactions "):
- on := strings.TrimPrefix(plc4xConf, "TraceTransactionManagerTransactions ")
- plc4x_config.TraceTransactionManagerWorkers = on == "true"
- case strings.HasPrefix(plc4xConf, "TraceDefaultMessageCodecWorker "):
- on := strings.TrimPrefix(plc4xConf, "TraceDefaultMessageCodecWorker ")
- plc4x_config.TraceTransactionManagerWorkers = on == "true"
- }
- default:
- return errors.Errorf("%s not found", commandText)
- }
- return nil
-}
-
func buildOutputArea(newPrimitive func(text string) tview.Primitive, application *tview.Application) *tview.Grid {
outputAreaHeader := newPrimitive("Output")
outputArea := tview.NewGrid().