MCPcopy Create free account
hub / github.com/diillson/chatcli / restoreTerminal

Method restoreTerminal

cli/cli.go:1286–1301  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1284}
1285
1286func (cli *ChatCLI) restoreTerminal() {
1287 if runtime.GOOS == "windows" {
1288 cmd := exec.Command("cmd", "/c", "cls") // Limpa a tela no Windows
1289 cmd.Stdout = os.Stdout
1290 if err := cmd.Run(); err != nil {
1291 cli.logger.Warn("Falha ao tentar limpar a tela do terminal no Windows", zap.Error(err))
1292 }
1293 return
1294 }
1295 cmd := exec.Command("stty", "sane")
1296 cmd.Stdin = os.Stdin
1297 if err := cmd.Run(); err != nil {
1298 cli.logger.Warn("Falha ao restaurar o terminal com 'stty sane'", zap.Error(err))
1299 }
1300 fmt.Print("\033[2J\033[H")
1301}
1302
1303// Helper para executar lógica do agente com cancelamento via Ctrl+C
1304func (cli *ChatCLI) runWithCancellation(parent context.Context, taskName string, fn func(context.Context) error) {

Callers 2

StartMethod · 0.95
resetTerminalMethod · 0.80

Calls 3

WarnMethod · 0.80
RunMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected