Alois Mahdal 2 месяцев назад
Родитель
Сommit
8a0b99ead1
1 измененных файлов: 8 добавлений и 0 удалений
  1. 8
    0
      app/main.go

+ 8
- 0
app/main.go Просмотреть файл

1
 package main
1
 package main
2
 
2
 
3
 import (
3
 import (
4
+	"bufio"
4
 	"fmt"
5
 	"fmt"
6
+	"os"
5
 )
7
 )
6
 
8
 
7
 // Ensures gofmt doesn't remove the "fmt" import in stage 1 (feel free to remove this!)
9
 // Ensures gofmt doesn't remove the "fmt" import in stage 1 (feel free to remove this!)
9
 
11
 
10
 func main() {
12
 func main() {
11
 	fmt.Print("$ ")
13
 	fmt.Print("$ ")
14
+	command, err := bufio.NewReader(os.Stdin).ReadString('\n')
15
+	if err != nil {
16
+		fmt.Fprintln(os.Stderr, "Error reading input: ", err)
17
+		os.Exit(1)
18
+	}
19
+	fmt.Println(command[:len(command)-1] + ": command not found")
12
 }
20
 }