Skip to content

Commit 6965b5c

Browse files
authored
Merge pull request #173 from codecrafters-io/andy/remove-exit-0
Replace `exit 0` with just `exit`
2 parents 83ecc12 + 4b8f7cf commit 6965b5c

File tree

4 files changed

+17
-28
lines changed

4 files changed

+17
-28
lines changed

stage_descriptions/base-04-pn5.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@ In this stage, you'll implement the `exit` builtin.
44

55
The [`exit`](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#exit) builtin is a special command that terminates the shell.
66

7-
It takes an optional numeric argument as the shell's [exit status](https://en.wikipedia.org/wiki/Exit_status):
8-
```bash
9-
$ exit 0 # Exit with status 0 (success)
10-
$ exit 1 # Exit with status 1 (error)
11-
```
12-
13-
When your shell receives the `exit` command, it should terminate immediately with the specified exit code.
7+
When your shell receives the `exit` command, it should terminate immediately.
148

159
### Tests
1610

@@ -25,13 +19,7 @@ It will then send an invalid command to your shell, followed by the `exit` comma
2519
```bash
2620
$ invalid_command_1
2721
invalid_command_1: command not found
28-
$ exit 0
22+
$ exit
2923
```
3024

31-
The tester will verify that:
32-
- Your shell terminates after receiving the `exit` command
33-
- Your shell exits with status code `0`
34-
35-
### Notes
36-
37-
- The tester will always pass in `0` as the argument to the `exit` command.
25+
The tester will verify that your shell terminates after receiving the `exit` command.

stage_descriptions/completions-02-gm9.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ In this stage, you'll extend your shell's tab completion to handle commands with
22

33
Your shell should now not only complete the command itself but also correctly handle the subsequent arguments that the user types.
44
This means that after completing the command with `<TAB>`, it should allow the user to continue typing arguments, and those arguments should also be interpreted correctly.
5-
You'll need to ensure commands like `echo ` and `type` autocomplete and still function correctly with arguments.
5+
You'll need to ensure commands like `echo` autocomplete and still function correctly with arguments.
66

77
### Tests
88

@@ -15,11 +15,12 @@ The tester will execute your program like this:
1515
The tests will simulate user input with tab presses and will execute builtin commands, similar to the previous stage, with added arguments:
1616

1717
1. **Input:** `ech<TAB>` `hello<ENTER>`
18-
* The tester expects the shell to first complete the `ech` to `echo` after `<TAB>`, then accept the `hello` argument, and after the `<ENTER>` key press, execute `echo hello`.
19-
* The shell should output `hello`.
2018

21-
2. **Input:** `exi<TAB>` `0<ENTER>`
22-
* The tester expects the shell to first complete `exi` to `exit` after `<TAB>`, then accept the `0` argument, and after the `<ENTER>` key press, execute `exit 0`.
23-
* The shell should exit with status code 0.
19+
- The tester expects the shell to first complete the `ech` to `echo` after `<TAB>`, then accept the `hello` argument, and after the `<ENTER>` key press, execute `echo hello`.
20+
- The shell should output `hello`.
2421

25-
The tester will verify that your shell properly completes the commands and executes the commands with the given arguments.
22+
2. **Input:** `ech<TAB>` `foo bar<ENTER>`
23+
- The tester expects the shell to first complete `ech` to `echo` after `<TAB>`, then accept the `foo bar` arguments, and after the `<ENTER>` key press, execute `echo foo bar`.
24+
- The shell should output `foo bar`.
25+
26+
The tester will verify that your shell properly completes the commands and executes the commands with the given arguments.

stage_descriptions/history-persistence-05-kz7.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ $ echo hello
1515
hello
1616
$ echo world
1717
world
18-
$ exit 0
18+
$ exit
1919
```
2020

2121
The tester will then expect the history file's contents to look like:
2222

2323
```txt
2424
echo hello
2525
echo world
26-
exit 0
26+
exit
2727
<|EMPTY LINE|>
28-
```
28+
```

stage_descriptions/history-persistence-06-jv2.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ It will then send the following commands to your shell:
2121
```bash
2222
$ echo new_command
2323
new_command
24-
$ exit 0
24+
$ exit
2525
```
2626

2727
The tester will then expect the history file's contents to look like:
@@ -30,6 +30,6 @@ The tester will then expect the history file's contents to look like:
3030
echo initial_command_1
3131
echo initial_command_2
3232
echo new_command
33-
exit 0
33+
exit
3434
<|EMPTY LINE|>
35-
```
35+
```

0 commit comments

Comments
 (0)