Alois Mahdal 1 nedēļu atpakaļ
vecāks
revīzija
8a0b99ead1
1 mainītis faili ar 8 papildinājumiem un 0 dzēšanām
  1. 8
    0
      app/main.go

+ 8
- 0
app/main.go Parādīt failu

@@ -1,7 +1,9 @@
1 1
 package main
2 2
 
3 3
 import (
4
+	"bufio"
4 5
 	"fmt"
6
+	"os"
5 7
 )
6 8
 
7 9
 // Ensures gofmt doesn't remove the "fmt" import in stage 1 (feel free to remove this!)
@@ -9,4 +11,10 @@ var _ = fmt.Print
9 11
 
10 12
 func main() {
11 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
 }