Files
lush/issues/04-argv-parsing.md
Cormac Shannon bad40fb65b Standardize issue status labels to done/open/in progress
Rename resolved→done (#1-4, #11), closed→done (#13, #18),
open (post-core)→open (#7), mark #9 as superseded by #21.
2026-03-15 19:33:49 +00:00

27 lines
906 B
Markdown

# 04 — Implement argv parsing (tokenize command strings)
**Status:** done
**Blocked by:** #01
**Blocks:** #06
Since we're not using a shell, we need our own command-line tokenizer to split a command string into `argv[]`.
## Must handle
- Simple whitespace splitting: `ls -l /tmp``["ls", "-l", "/tmp"]`
- Single-quoted strings: `echo 'hello world'``["echo", "hello world"]`
- Double-quoted strings with escapes: `echo "hello \"world\""`
- Backslash escaping outside quotes: `echo hello\ world`
- Mixed quoting: `echo "it's a test"`
## May handle (depending on #01 decisions)
- Variable/expression interpolation: `echo $HOME` or `echo ${dir}`
- Glob expansion: `ls *.lua` (could also defer to a later issue)
## Implementation
- Standalone C module, likely `lcmd_parse.c` or part of `lcmd.c`
- Returns a `char **argv` (NULL-terminated) + argc count
- Must handle memory allocation/cleanup