You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Variable key in parse_requirements function should be declared as local #681
The generated parse_requirements function declares the variable key without the local keyword, causing it to pollute the global scope. This leads to unexpected behavior when user scripts use a variable named key and then call another command via run().
Contents of bashly.yml
Reproduction Steps
Create a command script that uses a variable named key:
# src/my_command.sh
key="my_value"echo"Before run: key=$key"
run other_command
echo"After run: key=$key"# key is now overwritten
Generate the script with bashly generate
Run the command and observe that the key variable is overwritten after calling run()
Actual Behavior
In lib/bashly/views/command/parse_requirements_while.gtx:4, the variable key is declared without local:
while [[ $#-gt 0 ]];do
key="$1"case"$key"in
This should be:
while [[ $#-gt 0 ]];dolocal key="$1"case"$key"in
Expected Behavior
The key variable should be local to the parse_requirements function and not interfere with user-defined variables in command scripts.
Activity
DannyBen commentedon Nov 7, 2025
Confirmed. Looking into it.
DannyBen commentedon Nov 7, 2025
Fixed in #682 - thanks for reporting.
chudnyi commentedon Nov 8, 2025
Thank you, @DannyBen , for your hard work on this library! It's greatly appreciated.
DannyBen commentedon Nov 17, 2025
Fixed and released in v1.3.4.