Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/cmd/clear.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import (
)

func clearCommand(args []string) error {
if ui.ClearConsole() {
ui.ApplicationBanner()
return nil
}

clearCmd, err := getClearCommand()
if err != nil {
return fmt.Errorf("failed to determine clear command: %w", err)
Expand Down
27 changes: 3 additions & 24 deletions src/main.go
Original file line number Diff line number Diff line change
@@ -1,35 +1,14 @@
package main

import (
"bufio"
"fmt"
"os"
"strings"
"log"

"servercommander/src/cmd"
"servercommander/src/ui"
"servercommander/src/utils"
)

func main() {
ui.ApplicationBanner()
reader := bufio.NewReader(os.Stdin)

for {
fmt.Print(utils.Yellow, "\n>> ", utils.Reset)
input, err := reader.ReadString('\n')
if err != nil {
fmt.Println(utils.Red, "Failed to read input:", err, utils.Reset)
continue
}

command := strings.TrimSpace(input)
if command == "" {
continue
}

if err := cmd.Execute(command); err != nil {
fmt.Println(utils.Red, err, utils.Reset)
}
if err := ui.RunStandaloneConsole(cmd.Execute); err != nil {
log.Fatal(err)
Comment on lines 10 to +12

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Browser console cannot satisfy interactive prompts

Replacing the CLI loop with RunStandaloneConsole executes each command via HTTP but only forwards the initial command string. Commands that call utils.Prompt/PromptPassword still read from the process’s original os.Stdin (initialised at startup), which is no longer connected to the browser input. When users trigger interactive commands such as session add from the web UI, the prompts are rendered in the browser but the process waits for input on the hidden terminal, effectively hanging the command. Consider plumbing user input back to os.Stdin or rewriting prompts to use the web channel so interactive commands remain usable.

Useful? React with 👍 / 👎.

}
}
Loading