Skip to content

Commit 802f7da

Browse files
authored
Merge pull request #183 from codecrafters-io/TropicolX-patch-22
Revise "Missing completions #qm8"
2 parents fa40711 + b6697a6 commit 802f7da

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
In this stage, you'll refine your shell's tab completion behavior to handle cases where the user types an invalid command.
22

3-
When the user types a command that is not a known builtin and presses `<TAB>`, your shell should not attempt to autocomplete it. Instead, it should just keep what the user typed and should ring a bell.
4-
This means that if you type "xyz" and press `<TAB>`, the command should not change and you should hear a bell indicating that there are no valid completion options for "xyz".
3+
### Handling Invalid Completions
4+
5+
When the user types a command that doesn't match any known builtin and presses `<TAB>`, your shell should:
6+
7+
1. Leave the input unchanged (don't modify what the user typed)
8+
2. Ring a bell to indicate there are no valid completions
9+
10+
The bell is produced by printing the [bell character](https://en.wikipedia.org/wiki/Bell_character) `\x07` to the terminal. This typically produces an audible beep or visual flash, depending on the terminal settings.
511

612
### Tests
713

@@ -13,8 +19,11 @@ The tester will execute your program like this:
1319

1420
The tests will simulate the user typing an invalid command and pressing the `<TAB>` key:
1521

16-
1. **Input:** `xyz`<TAB>
17-
* The tester will first type `xyz` and then press `<TAB>`. The tester expects that the prompt still shows "xyz" and there is a bell sound.
22+
```bash
23+
$ xyz<TAB>
24+
$ xyz
25+
```
1826

19-
The tester will verify that your shell does not attempt completion on invalid commands, the bell is sent.
20-
The bell is sent by printing `\x07`, the [bell character](https://en.wikipedia.org/wiki/Bell_character).
27+
The tester will verify that:
28+
- The input remains unchanged when no completion is possible
29+
- The bell character is printed to indicate no matches

0 commit comments

Comments
 (0)