Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issues with argument parsing #8

Open
ryanong opened this issue Jan 17, 2023 · 3 comments
Open

issues with argument parsing #8

ryanong opened this issue Jan 17, 2023 · 3 comments

Comments

@ryanong
Copy link

ryanong commented Jan 17, 2023

So I'm writing some scripts and for some reason argument parsing is really difficult.

So looking at this code https://github.com/chaosaffe/split-tests/blob/main/action.yml#L61 for some reason the environment variables aren't parsed correctly. Specifically $EXCLUDE_GLOB

I have to eval them like this https://github.com/ryanong/split-tests/blob/patch-1/action.yml#L61 in order for the arguments to get consumed correctly. I have tried turning the arguments into a bash array but to application still messes up.

example broken code of array

ARGS=("--split-index=0" "--split-total=3" "--glob='spec/**/*_spec.rb'" "--junit" "--junit-path='report-tmp/rspec-*.xml'" "--exclude-glob='spec/features/**/*_spec.rb'")
echo $ARGS[@]
./split_tests $ARGS[@]
@leonid-shevtsov
Copy link
Owner

shouldn't the command be ./split_tests $ARGS[*]? i am no expert on bash arrays, but google says so https://linuxhandbook.com/bash-arrays/

@ryanong
Copy link
Author

ryanong commented Jan 18, 2023

Doesn't work either. Try locally

@leonid-shevtsov
Copy link
Owner

so, coming back to this, sorry i can't pay more attention to this at the present... but looking at your source code - could it help if you pass the exclude-glob param, even if it's empty? basically as you are already doing with glob.

-glob='${{ inputs.glob }}' -exclude-glob='${{ inputs.exclude-glob }}'

it should just receive an empty string value for exclude-glob, and it's the same thing as not passing it. So technically, that should resolve this issue.

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

No branches or pull requests

2 participants