Skip to content

feat(interpreter): implement trap -p flag and sorted trap listing#258

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

feat(interpreter): implement trap -p flag and sorted trap listing#258
chaliy merged 1 commit intomainfrom
claude/bashkit-bash-compatibility-BsDKD

Conversation

@chaliy
Copy link
Contributor

@chaliy chaliy commented Feb 25, 2026

Summary

  • Add trap -p flag to print traps in re-executable format
  • trap -p SIG prints trap for specific signal
  • Sort trap listing output alphabetically for deterministic ordering

Changes

  • crates/bashkit/src/interpreter/mod.rs: Add -p flag handling in trap builtin, sort trap listings
  • crates/bashkit/tests/spec_cases/bash/variables.test.sh: 5 new spec tests
  • specs/009-implementation-status.md: Update test counts (variables 92→97, Bash 906→911, Total 1324→1329)

Test plan

  • cargo test --all-features passes (including bash comparison tests)
  • cargo fmt --check clean
  • cargo clippy --all-targets --all-features -- -D warnings clean

Add `trap -p` support for printing trap commands in re-executable format:
- `trap -p`: prints all set traps
- `trap -p SIG`: prints trap for specific signal
- `trap` (no args): now sorts output alphabetically

Also sorts trap listing output for deterministic ordering.

Tests: 5 new spec tests (variables.test.sh: 92 → 97)
@chaliy chaliy merged commit 2d83847 into main Feb 25, 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