From a8ba2a640bad4a9eb7434a246dc5b652d283cacb Mon Sep 17 00:00:00 2001 From: "Lin, Hung-Shin" Date: Tue, 21 Nov 2023 12:15:44 +0800 Subject: [PATCH] feat: finish quest create --- quests/create/game.yml | 166 ++++++++++++++++++++++++++++++++++++ quests/discover/game.yml | 2 +- quests/get-started/game.yml | 10 +-- 3 files changed, 172 insertions(+), 6 deletions(-) diff --git a/quests/create/game.yml b/quests/create/game.yml index 4463ad9..fad30f0 100644 --- a/quests/create/game.yml +++ b/quests/create/game.yml @@ -1,3 +1,169 @@ title: 建立檔案與資料夾 instruction: | 在這個關卡中,你將學習如何建立檔案與資料夾。 + +stages: + - id: start + task: 輸入 `echo start` 來開始 + condition: + command: + - ^echo start + responses: + - type: narrative + content: + - 這次要學習的指令是 `touch` 指令。 + - '`touch` 指令可以建立一個檔案。' + - 接下來,請你試著在終端機上建立一個檔案,檔名為 `hello.txt`。 + hints: + - 輸入 `touch hello.txt` 來建立一個檔案 + + - id: touch + task: 使用 `touch` 指令來建立一個檔案 + requirements: + - start + condition: + files: + - path: hello.txt + type: file + responses: + - type: narrative + content: + - 你應該可以看到終端機上沒有任何回應。 + - 這表示 `touch` 指令已經成功建立了一個檔案。 + - 接下來,請你用之前學過的 `ls` 指令來查看目前所在資料夾中有哪些檔案。 + hints: + - 輸入 `ls` 指令來查看目前所在資料夾中有哪些檔案 + + - id: ls-touch + task: 使用 `ls` 指令來查看新建立的檔案 + requirements: + - touch + condition: + command: + - ^ls$ + output: + - hello.txt + responses: + - type: narrative + content: + - 你應該可以看到終端機上顯示了 `hello.txt` 這個檔案。 + - 我們再來試試建立其他的檔案吧! + - 請你試著在終端機上建立另一個檔案,檔名為 `world.txt`。 + hints: + - 輸入 `touch world.txt` 來建立一個檔案 + + - id: touch-2 + task: 使用 `touch` 指令來建立另一個檔案 `world.txt` + requirements: + - ls-touch + condition: + files: + - path: world.txt + type: file + responses: + - type: narrative + content: + - 非常好,你已經成功建立了第二個檔案。 + - 接下來,請你用之前學過的 `ls` 指令來查看剛剛建立的兩個檔案。 + hints: + - 輸入 `ls` 指令來查看目前所在資料夾中有哪些檔案 + + - id: ls-2 + task: 使用 `ls` 指令來查看剛剛建立的兩個檔案 + requirements: + - touch-2 + condition: + command: + - ^ls$ + output: + - hello.txt + - world.txt + responses: + - type: narrative + content: + - 你應該可以看到終端機上顯示了 `hello.txt` 和 `world.txt` 這兩個檔案。 + - 接下來,我們來試試看建立資料夾吧! + - '`mkdir` 指令可以建立一個空的資料夾。' + - 使用方式是 `mkdir [資料夾名稱]`。 + - 請你試著在終端機上建立一個資料夾,名稱為 `notes`。 + hints: + - 輸入 `mkdir notes` 來建立一個資料夾 + + - id: mkdir + task: 使用 `mkdir` 指令建立 `notes` 資料夾 + requirements: + - ls-2 + condition: + files: + - path: notes + type: folder + responses: + - type: narrative + content: + - 非常好,你已經成功建立了 `notes` 資料夾。 + - 接下來,請你用 `ls` 指令來查看剛剛建立的資料夾。 + + - id: ls-mkdir + task: 使用 `ls` 查看剛建立的資料夾 + requirements: + - mkdir + condition: + command: + - ^ls$ + output: + - notes + responses: + - type: narrative + content: + - 你應該可以看到終端機上顯示了 `notes` 這個資料夾。 + - 接下來,我們要在 `notes` 資料夾中建立一個 `note.txt` 的檔案。 + - 首先,我們要先進入 `notes` 資料夾。 + - 還記得之前的 `cd` 指令嗎?請你試著使用 `cd` 指令來進入 `notes` 資料夾。 + hints: + - 輸入 `cd notes` 來進入 `notes` 資料夾 + - 可以在輸入到 `cd n` 時按下 `Tab` 鍵來自動補齊資料夾名稱 + + - id: cd-notes + task: 移動到 `notes` 資料夾 + requirements: + - ls-mkdir + condition: + pwd: + - notes + responses: + - type: narrative + content: + - 你已經成功進入了 `notes` 資料夾。 + - 接下來,請你試著在 `notes` 資料夾裡建立一個檔案,檔名為 `note.txt`。 + hints: + - 輸入 `touch note.txt` 來建立一個檔案 + + - id: touch-note + task: 在 `notes` 中建立 `note.txt` 檔案 + requirements: + - cd-notes + condition: + files: + - path: notes/note.txt + type: file + responses: + - type: narrative + content: + - 非常好,你已經成功建立了 `note.txt` 檔案。 + - 跟之前一樣,你可以使用 `ls` 指令來查看目前所在資料夾中有哪些檔案。 + + - id: END + task: 使用 `ls` 指令來查看目前所在資料夾中有哪些檔案 + requirements: + - touch-note + condition: + command: + - ^ls + output: + - note.txt + responses: + - type: narrative + content: + - 你應該可以看到終端機上顯示了 `note.txt` 這個檔案。 + - 恭喜你完成了這個關卡! + - 在下一個關卡中,你將學習如何複製檔案與資料夾。 diff --git a/quests/discover/game.yml b/quests/discover/game.yml index f293044..7556d65 100644 --- a/quests/discover/game.yml +++ b/quests/discover/game.yml @@ -34,7 +34,7 @@ stages: command: - echo .* responses: - - types: narrative + - type: narrative content: - 你應該可以看到終端機上顯示了你剛才輸入的文字。 - 接下來,請你試著在終端機上顯示 `How are you?`。 diff --git a/quests/get-started/game.yml b/quests/get-started/game.yml index fcac1e9..2203bbd 100644 --- a/quests/get-started/game.yml +++ b/quests/get-started/game.yml @@ -36,7 +36,7 @@ stages: command: - ls responses: - - types: narrative + - type: narrative content: - 一瞬間,視野變得清晰起來,你發現自己身處在一個石頭建築的房間裡。 - 你發現了一個檔案,檔名是 `forgotten-scroll.txt`。 @@ -47,10 +47,10 @@ stages: - 使用指令 `cat [ 檔案名稱 ]` (concatenate)來查看檔案內容。 - 我可以為你提供一些指令的提示,只要輸入指令的前幾個字元,然後按下 `Tab` 鍵,就可以看到提示了。 - 例如你只要輸入檔案名稱的前幾個字元,然後按下 `Tab` 鍵,就可以看到提示了。 - hints: | - ➤ 使用 `cat [ 檔案名稱 ]` 指令來查看檔案內容。 - ➤ 使用 `Tab` 鍵來取得指令提示。 - ➤ 如果卡在未知的情況,按下 `Ctrl + C` 嘗試離開。 + hints: + - 使用 `cat [ 檔案名稱 ]` 指令來查看檔案內容。 + - 使用 `Tab` 鍵來取得指令提示。 + - 如果卡在未知的情況,按下 `Ctrl + C` 嘗試離開。 - id: read-forgotten-scroll task: 查看卷軸