Skip to content

feat: $ and diagram update - #47

Merged
Aleksandergreg merged 1 commit into
mainfrom
feat/exit-status-and-diagram
Oct 10, 2026
Merged

Aleksandergreg merged 1 commit into
mainfrom
feat/exit-status-and-diagram

Conversation

@Aleksandergreg

Copy link
Copy Markdown
Owner

$?

  • It uses real Linux exit codes, not just 0 and 1:
Status When
0 success
1 most failures, including grep with no match and false
2 shell syntax errors, and errors from ls, grep or sort
126 a script that exists but can't run (directory, not executable, missing #!/bin/sh)
127 an unknown command or missing script
  • It works with $?, ${?} and inside double quotes. Single-quoted or escaped $? stays literal.
  • A command skipped by && or || keeps the previous status, and a blank or comment line doesn't reset it.
  • It carries over between lines, so ls /nope followed by echo $? prints 2.
  • Each script starts at 0, and a script's final status becomes the caller's $?.
  • In the built game, ls /nope then echo $? printed 2, and an unknown command reported 127.
  • Other special parameters ($1, $$, $#) are still rejected.
  • The in-game help and the player and safety docs list the codes, and new tests cover each status plus scripts and persistence.

Diagram

  • I updated the Mermaid source and confirmed it renders with Mermaid CLI 11, downloaded with npx into the scratchpad only.
  • I didn't replace the published SVG with that raw render. All three repo diagrams are hand-made illustrations in a custom style, so I edited the SVG directly to match:
    • a "Split lists" gate before Lex
    • Lex now runs once per pipeline and mentions $?
    • the redirect box notes that > empties the file first and restores it on failure
    • a loop back for the next pipeline, labelled with the ; / && / || rules

$?
- It uses real Linux exit codes, not just 0 and 1:

| Status | When                                                                              |
|--------|-----------------------------------------------------------------------------------|
| 0      | success                                                                           |
| 1      | most failures, including grep with no match and false                             |
| 2      | shell syntax errors, and errors from ls, grep or sort                             |
| 126    | a script that exists but can't run (directory, not executable, missing #!/bin/sh) |
| 127    | an unknown command or missing script                                              |

- It works with $?, ${?} and inside double quotes. Single-quoted or escaped $? stays literal.
- A command skipped by && or || keeps the previous status, and a blank or comment line doesn't reset it.
- It carries over between lines, so ls /nope followed by echo $? prints 2.
- Each script starts at 0, and a script's final status becomes the caller's $?.
- In the built game, ls /nope then echo $? printed 2, and an unknown command reported 127.
- Other special parameters ($1, $$, $#) are still rejected.
- The in-game help and the player and safety docs list the codes, and new tests cover each status plus scripts and persistence.

Diagram
- I updated the Mermaid source and confirmed it renders with Mermaid CLI 11, downloaded with npx into the scratchpad only.
- I didn't replace the published SVG with that raw render. All three repo diagrams are hand-made illustrations in a custom style, so I edited the SVG directly to match:
  - a "Split lists" gate before Lex
  - Lex now runs once per pipeline and mentions $?
  - the redirect box notes that > empties the file first and restores it on failure
  - a loop back for the next pipeline, labelled with the ; / && / ||
    rules
@Aleksandergreg
Aleksandergreg merged commit bd43343 into main Oct 10, 2026
7 checks passed
@Aleksandergreg
Aleksandergreg deleted the feat/exit-status-and-diagram branch October 10, 2026 09:21
Aleksandergreg pushed a commit that referenced this pull request Oct 10, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.12.0](v0.11.0...v0.12.0)
(2026-10-10)


### Features

* $ and diagram update
([#47](#47))
([bd43343](bd43343))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant