From e692500606d6856424560533e6531ed2abb85576 Mon Sep 17 00:00:00 2001 From: David Haukeness Date: Sun, 20 Oct 2019 15:54:17 -0600 Subject: [PATCH] removed os.Args in favor of flags functionality. created emoji flag --- main.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index efa5640..98de32b 100644 --- a/main.go +++ b/main.go @@ -1,9 +1,9 @@ package main import ( + "flag" "fmt" "log" - "os" "strings" "time" @@ -39,11 +39,9 @@ func main() { g.SetManagerFunc(layout) go populateList() go updateChatWindow() - if len(os.Args) > 1 { - os.Args[0] = "join" - RunCommand(os.Args...) - - } + // use flag to parse command line arguments + flag.BoolVar(&UNICODE_EMOJI_SUPPORT, "ucode-emoji", false, "Enables unicode emoji printing to screen for supported systems") + flag.Parse() fmt.Println("initKeybindings") if err := initKeybindings(); err != nil { fmt.Printf("%+v", err) @@ -238,6 +236,9 @@ func printToView(viewName string, message string) { if err != nil { return err } else { + if UNICODE_EMOJI_SUPPORT { + message = emojiUnicodeConvert(message) + } fmt.Fprintf(updatingView, "%s\n", message) } return nil @@ -489,6 +490,7 @@ func handleInput(viewName string) error { cmd[0] = inputString[:1] RunCommand(cmd...) } else { + inputString = resolveRootEmojis(inputString) go sendChat(inputString) } // restore any tab completion view titles on input commit