feat(interpreter): implement declare -l/-u case conversion attributes#256
Merged
feat(interpreter): implement declare -l/-u case conversion attributes#256
Conversation
Add support for `declare -l` (lowercase) and `declare -u` (uppercase) variable attributes. When set, all subsequent assignments to the variable are automatically converted to the specified case. Implementation: - Parse `-l` and `-u` flags in `execute_declare_builtin` - Store attributes as `_LOWER_<name>` / `_UPPER_<name>` marker variables - Apply case conversion in `set_variable()` for subsequent assignments - Setting one attribute clears the opposite (e.g., -u clears _LOWER_) Features: - `declare -l x=HELLO` → x=hello - `declare -u x=hello` → x=HELLO - Attribute persists: `declare -l x; x=WORLD` → x=world - Works in functions: `declare -u result="$1"` Tests: 7 new spec tests (declare.test.sh: 16 → 23)
3929985 to
40eabf3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
declare -l(lowercase) anddeclare -u(uppercase) variable attributesset_variable()call_LOWER_<name>/_UPPER_<name>marker variables (consistent with existing_READONLY_*,_NAMEREF_*patterns)Changes
crates/bashkit/src/interpreter/mod.rs: Parse-l/-uflags, apply case conversion in declare andset_variable()crates/bashkit/tests/spec_cases/bash/declare.test.sh: 7 new spec tests covering basic, subsequent assignment, mixed case, override, and function usagespecs/009-implementation-status.md: Update test counts (declare 16→23, Bash 893→900, Total 1311→1318)Test plan
cargo test --all-featurespassescargo fmt --checkcleancargo clippy --all-targets --all-features -- -D warningsclean