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
Unbound variable error in dir2prompt.sh script after build
Description
After building the dir2prompt util using the provided justfile, running the resulting executable in the build directory produces an "unbound variable" error. This error prevents the script from executing correctly and limits its usability.
Steps to Reproduce
Clone the repository
Run the build process using the command: just build
Change to the build directory
Attempt to run the built script with various argument combinations, such as:
./dir2prompt .
Error Message
When running the built script, the following error is encountered:
./dir2prompt.sh: line 202: args[2]: unbound variable
Expected Behavior
The built script should run without errors for all valid argument combinations, including when fewer than three arguments are provided.
Actual Behavior
The built script throws an "unbound variable" error when attempting to access args[2], particularly when fewer than three arguments are provided.
Possible Cause
The error seems to originate from line 202 in the built script, where it's trying to access args[2] without first checking if it exists. This suggests that the argument parsing or handling in the script is not properly accounting for cases with fewer arguments.
Proposed Fix
I have prepared a fix for this issue that includes the following changes:
Modified the argument parsing in the main execution part to handle cases with fewer arguments.
Updated the parse_arguments function to output arguments in a more robust manner.
Added default values for required variables to ensure they always have a value.
Updated the README to include rg (ripgrep) as a dependency.
Updated the version number to reflect this bug fix.
These changes allow the script to run without errors for all valid argument combinations and ensure users are aware of all required dependencies.
System Information
OS: macOS, version 14.6, build 23G80
Shell version: fish, version 3.7.1
Additional Notes
I have tested the fix by rebuilding the script and verifying that it resolves the unbound variable error when run from the build directory. I'm prepared to submit a pull request with these changes.
Let me know if you need any further information.
The text was updated successfully, but these errors were encountered:
Unbound variable error in dir2prompt.sh script after build
Description
After building the
dir2prompt
util using the providedjustfile
, running the resulting executable in the build directory produces an "unbound variable" error. This error prevents the script from executing correctly and limits its usability.Steps to Reproduce
just build
Error Message
When running the built script, the following error is encountered:
Expected Behavior
The built script should run without errors for all valid argument combinations, including when fewer than three arguments are provided.
Actual Behavior
The built script throws an "unbound variable" error when attempting to access
args[2]
, particularly when fewer than three arguments are provided.Possible Cause
The error seems to originate from line 202 in the built script, where it's trying to access
args[2]
without first checking if it exists. This suggests that the argument parsing or handling in the script is not properly accounting for cases with fewer arguments.Proposed Fix
I have prepared a fix for this issue that includes the following changes:
parse_arguments
function to output arguments in a more robust manner.rg
(ripgrep) as a dependency.These changes allow the script to run without errors for all valid argument combinations and ensure users are aware of all required dependencies.
System Information
Additional Notes
I have tested the fix by rebuilding the script and verifying that it resolves the unbound variable error when run from the build directory. I'm prepared to submit a pull request with these changes.
Let me know if you need any further information.
The text was updated successfully, but these errors were encountered: