removed os.Args in favor of flags functionality. created emoji flag
This commit is contained in:
14
main.go
14
main.go
@ -1,9 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -39,11 +39,9 @@ func main() {
|
|||||||
g.SetManagerFunc(layout)
|
g.SetManagerFunc(layout)
|
||||||
go populateList()
|
go populateList()
|
||||||
go updateChatWindow()
|
go updateChatWindow()
|
||||||
if len(os.Args) > 1 {
|
// use flag to parse command line arguments
|
||||||
os.Args[0] = "join"
|
flag.BoolVar(&UNICODE_EMOJI_SUPPORT, "ucode-emoji", false, "Enables unicode emoji printing to screen for supported systems")
|
||||||
RunCommand(os.Args...)
|
flag.Parse()
|
||||||
|
|
||||||
}
|
|
||||||
fmt.Println("initKeybindings")
|
fmt.Println("initKeybindings")
|
||||||
if err := initKeybindings(); err != nil {
|
if err := initKeybindings(); err != nil {
|
||||||
fmt.Printf("%+v", err)
|
fmt.Printf("%+v", err)
|
||||||
@ -238,6 +236,9 @@ func printToView(viewName string, message string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
|
if UNICODE_EMOJI_SUPPORT {
|
||||||
|
message = emojiUnicodeConvert(message)
|
||||||
|
}
|
||||||
fmt.Fprintf(updatingView, "%s\n", message)
|
fmt.Fprintf(updatingView, "%s\n", message)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -489,6 +490,7 @@ func handleInput(viewName string) error {
|
|||||||
cmd[0] = inputString[:1]
|
cmd[0] = inputString[:1]
|
||||||
RunCommand(cmd...)
|
RunCommand(cmd...)
|
||||||
} else {
|
} else {
|
||||||
|
inputString = resolveRootEmojis(inputString)
|
||||||
go sendChat(inputString)
|
go sendChat(inputString)
|
||||||
}
|
}
|
||||||
// restore any tab completion view titles on input commit
|
// restore any tab completion view titles on input commit
|
||||||
|
|||||||
Reference in New Issue
Block a user