From 6cc285d1e8e2184466cab608581cbc2be14be078 Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Thu, 12 Dec 2024 21:12:25 +0300 Subject: [PATCH] add the custom separator to the menu --- cmd/africastalking/main.go | 9 ++++++--- cmd/async/main.go | 9 ++++++--- cmd/http/main.go | 9 ++++++--- cmd/main.go | 11 +++++++---- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/cmd/africastalking/main.go b/cmd/africastalking/main.go index 7d1caa8..f57f8f4 100644 --- a/cmd/africastalking/main.go +++ b/cmd/africastalking/main.go @@ -115,6 +115,7 @@ func main() { var engineDebug bool var host string var port uint + var separator string flag.StringVar(&dbDir, "dbdir", ".state", "database dir to read from") flag.StringVar(&resourceDir, "resourcedir", path.Join("services", "registration"), "resource dir") flag.StringVar(&database, "db", "gdbm", "database to be used") @@ -122,6 +123,7 @@ func main() { flag.UintVar(&size, "s", 160, "max size of output") flag.StringVar(&host, "h", initializers.GetEnv("HOST", "127.0.0.1"), "http host") flag.UintVar(&port, "p", initializers.GetEnvUint("PORT", 7123), "http port") + flag.StringVar(&separator, "sep", ": ", "custom separator for the menu") flag.Parse() logg.Infof("start command", "build", build, "dbdir", dbDir, "resourcedir", resourceDir, "outputsize", size) @@ -131,9 +133,10 @@ func main() { pfp := path.Join(scriptDir, "pp.csv") cfg := engine.Config{ - Root: "root", - OutputSize: uint32(size), - FlagCount: uint32(128), + Root: "root", + OutputSize: uint32(size), + FlagCount: uint32(128), + MenuSeparator: separator, } if engineDebug { diff --git a/cmd/async/main.go b/cmd/async/main.go index e4c94b0..1fdc532 100644 --- a/cmd/async/main.go +++ b/cmd/async/main.go @@ -53,6 +53,7 @@ func main() { var engineDebug bool var host string var port uint + var separator string flag.StringVar(&sessionId, "session-id", "075xx2123", "session id") flag.StringVar(&dbDir, "dbdir", ".state", "database dir to read from") flag.StringVar(&resourceDir, "resourcedir", path.Join("services", "registration"), "resource dir") @@ -61,6 +62,7 @@ func main() { flag.UintVar(&size, "s", 160, "max size of output") flag.StringVar(&host, "h", initializers.GetEnv("HOST", "127.0.0.1"), "http host") flag.UintVar(&port, "p", initializers.GetEnvUint("PORT", 7123), "http port") + flag.StringVar(&separator, "sep", ": ", "custom separator for the menu") flag.Parse() logg.Infof("start command", "dbdir", dbDir, "resourcedir", resourceDir, "outputsize", size, "sessionId", sessionId) @@ -70,9 +72,10 @@ func main() { pfp := path.Join(scriptDir, "pp.csv") cfg := engine.Config{ - Root: "root", - OutputSize: uint32(size), - FlagCount: uint32(128), + Root: "root", + OutputSize: uint32(size), + FlagCount: uint32(128), + MenuSeparator: separator, } if engineDebug { diff --git a/cmd/http/main.go b/cmd/http/main.go index 96e2688..aa7d00a 100644 --- a/cmd/http/main.go +++ b/cmd/http/main.go @@ -42,6 +42,7 @@ func main() { var engineDebug bool var host string var port uint + var separator string flag.StringVar(&dbDir, "dbdir", ".state", "database dir to read from") flag.StringVar(&resourceDir, "resourcedir", path.Join("services", "registration"), "resource dir") flag.StringVar(&database, "db", "gdbm", "database to be used") @@ -49,6 +50,7 @@ func main() { flag.UintVar(&size, "s", 160, "max size of output") flag.StringVar(&host, "h", initializers.GetEnv("HOST", "127.0.0.1"), "http host") flag.UintVar(&port, "p", initializers.GetEnvUint("PORT", 7123), "http port") + flag.StringVar(&separator, "sep", ": ", "custom separator for the menu") flag.Parse() logg.Infof("start command", "dbdir", dbDir, "resourcedir", resourceDir, "outputsize", size) @@ -58,9 +60,10 @@ func main() { pfp := path.Join(scriptDir, "pp.csv") cfg := engine.Config{ - Root: "root", - OutputSize: uint32(size), - FlagCount: uint32(128), + Root: "root", + OutputSize: uint32(size), + FlagCount: uint32(128), + MenuSeparator: separator, } if engineDebug { diff --git a/cmd/main.go b/cmd/main.go index 9599eb7..aec6a14 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -34,11 +34,13 @@ func main() { var sessionId string var database string var engineDebug bool + var separator string flag.StringVar(&sessionId, "session-id", "075xx2123", "session id") flag.StringVar(&database, "db", "gdbm", "database to be used") flag.StringVar(&dbDir, "dbdir", ".state", "database dir to read from") flag.BoolVar(&engineDebug, "d", false, "use engine debug output") flag.UintVar(&size, "s", 160, "max size of output") + flag.StringVar(&separator, "sep", ": ", "custom separator for the menu") flag.Parse() logg.Infof("start command", "dbdir", dbDir, "outputsize", size) @@ -49,10 +51,11 @@ func main() { pfp := path.Join(scriptDir, "pp.csv") cfg := engine.Config{ - Root: "root", - SessionId: sessionId, - OutputSize: uint32(size), - FlagCount: uint32(128), + Root: "root", + SessionId: sessionId, + OutputSize: uint32(size), + FlagCount: uint32(128), + MenuSeparator: separator, } resourceDir := scriptDir