How cadenfinley/cjsh works
cjsh is a POSIX-first scripting shell with a richer interactive terminal experience. A user enters commands at the interactive prompt or supplies a script; the shell parses and interprets shell syntax, expands values and patterns, then dispatches builtins or external commands and tracks execution status. Interactive editing, completions, highlighting, prompt styling, keybindings, and history are major documented capabilities. The source index supports several execution dependencies; other links are left dashed where implementation excerpts were not provided.
Main entry points: editline.c Line editor · interpreter.cpp Interpreter · exec.cpp Command execution · shell.cpp Shell lifecycle
Components 20
Shell Runtime
- Shell lifecycle
cjsh-core/src/core/shell.cpp - Interactive loop
cjsh-core/src/core/main_loop.cpp - Command execution
cjsh-core/src/exec/exec.cpp - Builtin commands
cjsh-core/src/builtin - Job control
cjsh-core/src/core/job_control.cpp - Signal handling
cjsh-core/src/core/signal_handler.cpp
Shell Language
- Command parser
cjsh-core/src/parser/parser.cpp - Interpreter
cjsh-core/src/interpreter/interpreter.cpp - Word expansion
cjsh-core/src/parser/expansion_engine.cpp - Variable manager
cjsh-core/src/interpreter/variable_manager.cpp - Command validation
cjsh-core/src/validation/validation.cpp
Interactive Experience
- Line editor
cjsh-isocline/src/edit/editline.c - Completions
cjsh-core/src/completion/cjsh_completions.cpp - Syntax highlighting
cjsh-core/src/highlighter/cjsh_syntax_highlighter.cpp - Prompt styling
cjsh-core/src/core/prompt.cpp - History search
cjsh-isocline/src/edit/history.c - Editor history
cjsh-isocline/src/edit/history.c
Terminal Services
- Terminal I/O
cjsh-isocline/src/terminal/tty.c - Terminal rendering
cjsh-isocline/src/terminal/term.c
Other components
- Shell user
Connections 20
- Shell user → Interactive loop: enters commands
- Interactive loop → Shell lifecycle: runs shell
- Shell lifecycle → Command parser: uses parser
- Shell lifecycle → Signal handling: uses signals
- Command parser → Interpreter: passes syntax
- Interpreter → Word expansion: expands words
- Interpreter → Variable manager: accesses variables
- Interpreter → Command validation: validates commands
- Command execution → Interpreter: invokes interpreter
cjsh-core/src/exec/exec.cpp - Command execution → Builtin commands: dispatches builtins
cjsh-core/src/exec/exec.cpp - Command execution → Job control: uses job control
cjsh-core/src/exec/exec.cpp - Command execution → Shell lifecycle: uses shell state
cjsh-core/src/exec/exec.cpp - Interactive loop → Line editor: reads input
- Line editor → Completions: requests candidates
- Line editor → Syntax highlighting: highlights input
- Line editor → Prompt styling: displays prompt
- Line editor → Editor history: uses history
- Line editor → Terminal I/O: reads keystrokes
cjsh-isocline/src/edit/editline.c - Line editor → Terminal rendering: renders line
cjsh-isocline/src/edit/editline.c - Terminal I/O → Terminal rendering: supports terminal
cjsh-isocline/src/terminal/term.c