Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
oq-x committed Nov 3, 2023
1 parent f017b38 commit 7eb9620
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var CB = color.New(color.FgCyan, color.Bold).SprintFunc()
var RB = color.New(color.FgRed, color.Bold).SprintFunc()
var YB = color.New(color.FgYellow, color.Bold).SprintFunc()

var R = color.New(color.FgRed).SprintFunc()
var HR = color.New(color.FgHiRed).SprintFunc()
var C = color.New(color.FgCyan).SprintFunc()

var colors = map[string]color.Attribute{
Expand Down
11 changes: 7 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ func main() {
// The extremely fancy custom terminal thing
func scanConsole(srv *server.Server) {
var command string
var b [1]byte
for {
var b [1]byte
os.Stdin.Read(b[:])

switch b[0] {
Expand All @@ -109,7 +109,7 @@ func scanConsole(srv *server.Server) {

cmd := srv.GetCommandGraph().FindCommand(args[0])
if cmd == nil {
fmt.Printf("\r> %s", logger.R(command))
fmt.Printf("\r> %s", logger.HR(command))
} else {
if len(args) > 1 {
fmt.Printf("\r> %s %s", args[0], logger.C(strings.Join(args[1:], " ")))
Expand All @@ -126,8 +126,11 @@ func scanConsole(srv *server.Server) {
fmt.Print("> ")
srv.ConsoleCommand("stop")
case 13: // enter - run the command and clear it
fmt.Print("\r> \n\r")
command = strings.TrimSpace(command)
if command == "" {
continue
}
fmt.Print("\r> \n\r")
args := strings.Split(command, " ")

cmd := srv.GetCommandGraph().FindCommand(args[0])
Expand All @@ -148,7 +151,7 @@ func scanConsole(srv *server.Server) {

cmd := srv.GetCommandGraph().FindCommand(args[0])
if cmd == nil {
fmt.Printf("\r> %s", logger.R(command))
fmt.Printf("\r> %s", logger.HR(command))
} else {
if len(args) > 1 {
fmt.Printf("\r> %s %s", args[0], logger.C(strings.Join(args[1:], " ")))
Expand Down

0 comments on commit 7eb9620

Please sign in to comment.