Skip to content

Comments

feat(bash): implement select construct#251

Merged
chaliy merged 1 commit intomainfrom
claude/bashkit-bash-compatibility-BsDKD
Feb 24, 2026
Merged

feat(bash): implement select construct#251
chaliy merged 1 commit intomainfrom
claude/bashkit-bash-compatibility-BsDKD

Conversation

@chaliy
Copy link
Contributor

@chaliy chaliy commented Feb 24, 2026

Summary

  • Implement select var in list; do body; done construct
  • Parse into SelectCommand AST node (similar to ForCommand)
  • Execute by reading from pipeline_stdin, printing numbered menu to stderr
  • Sets variable to selected item, REPLY to raw input
  • Matches bash EOF behavior: prints newline to stdout and exits with code 1
  • 5 spec tests: basic selection, REPLY variable, invalid input, multiple iterations, EOF exit

Test plan

  • cargo test --all-features passes
  • cargo clippy clean
  • cargo fmt --check clean
  • bash_comparison_tests 789/789 match real bash
  • All 864 bash spec tests pass (859 pass + 5 skip)

Parse and execute `select var in list; do body; done`. Reads from
pipeline_stdin, prints numbered menu to stderr, sets variable to
selected item and REPLY to raw input. Matches bash EOF behavior
(prints newline, exits with code 1).

Adds SelectCommand AST node, parser, and interpreter execution.
5 spec tests covering basic selection, REPLY, invalid input,
multiple iterations, and EOF exit.
@chaliy chaliy merged commit a71e89a into main Feb 24, 2026
16 checks passed
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.

2 participants