浏览代码

Implement #CZ2

Alois Mahdal 1周前
父节点
当前提交
8a0b99ead1
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8
    0
      app/main.go

+ 8
- 0
app/main.go 查看文件

@@ -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
 }