How spaceinventor/slash works
Slash is a C command-line shell library: it reads and edits interactive input, resolves commands, and runs registered handlers. Its capabilities include built-in commands, scripts via run, command and path completion, option parsing, and extension commands supplied by dynamically loaded APMs. The excerpts show key calls among these components; APM section registration and command-list behavior are documented in the README. Other links are omitted where the sampled source does not establish them.
Main entry points: slash.c Shell runtime · builtins.c Built-in commands · run.c Script runner · slash_list.c Command registry
Components 16
Interactive Shell
- Shell runtime
src/slash.c - Line editing
src/slash.c - Command history
src/slash.c - Input and output
src/slash.c
Commands
- Built-in commands
src/builtins.c - Script runner
src/run.c - Builtin declarations
src/builtins.h
Extensions
- Command registry
src/slash_list.c - APM extension
- Command API
include/slash/slash.h
Parsing Utilities
- Argument builder
src/slash.c - Option parser
src/optparse.c - Default options API
include/slash/dflopt.h
Completion
- Completion engine
src/completer.c - Completion API
include/slash/completer.h
Other components
- Shell user
Connections 17
- Shell user → Shell runtime: enters commands
src/slash.c - Shell runtime → Argument builder: builds arguments
src/slash.c - Shell runtime → Command registry: finds commands
- Shell runtime → Input and output: reads and writes
src/slash.c - Shell runtime → Line editing: edits input
src/slash.c - Line editing → Command history: updates history
src/slash.c - Shell runtime → Built-in commands: dispatches commands
- Built-in commands → Option parser: parses options
src/builtins.c - Built-in commands → Shell runtime: repeats command
src/builtins.c - Built-in commands → Completion engine: uses completers
src/builtins.c - Shell runtime → Script runner: dispatches run
- Script runner → Option parser: parses options
src/run.c - Script runner → Shell runtime: executes script lines
src/run.c - APM extension → Command registry: registers commands
README.md - Command registry → Shell runtime: provides commands
README.md - Completion engine → Command API: uses command data
src/completer.c - Completion API → Completion engine: declares API for
include/slash/completer.h