Add option to render client UI in pure ASCII

This commit is contained in:
raul 2024-05-14 16:31:36 +02:00
parent b2f9ff5016
commit c7a34a7d93
3 changed files with 10 additions and 0 deletions

View File

@ -16,6 +16,7 @@ Usage:
mini-chat client [flags]
Flags:
-a, --ascii Render UI in pure ASCII, might help with rendering issues
-h, --help help for client
--insecure [UNSAFE] Do not use TLS encryption
-i, --ip string Server IP to connect to

View File

@ -37,6 +37,7 @@ func init() {
clientCmd.PersistentFlags().StringP("ip", "i", "", "Server IP to connect to")
clientCmd.PersistentFlags().StringP("port", "p", "1302", "Server port to connect to")
clientCmd.Flags().Bool("insecure", false, "[UNSAFE] Do not use TLS encryption")
clientCmd.Flags().BoolP("ascii", "a", false, "Render UI in pure ASCII, might help with rendering issues")
}
func setClientParameters(cmd *cobra.Command) error {
@ -63,5 +64,9 @@ func setClientParameters(cmd *cobra.Command) error {
clientInsecure = true
}
ascii, err := cmd.Flags().GetBool("ascii")
if ascii == true {
useASCII = true
}
return nil
}

View File

@ -41,6 +41,7 @@ var (
serverIP string
data Message
clientInsecure bool
useASCII bool
)
func startSecureConnection() (net.Conn, error) {
@ -185,6 +186,9 @@ func GUI() {
g.SetManagerFunc(layout)
g.Mouse = true
g.Cursor = true
if useASCII == true {
g.ASCII = true
}
initKeybindings(g)
go listenMessages(g)