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

Programmatic filtering #216

Open
jamiekyle-eb opened this issue Jan 28, 2019 · 3 comments
Open

Programmatic filtering #216

jamiekyle-eb opened this issue Jan 28, 2019 · 3 comments

Comments

@jamiekyle-eb
Copy link
Contributor

Idea:

bolt ws --when [ -f ./tsconfig.json ] -- tsc
@lukebatchelor
Copy link
Member

Would we attempt to parse the test block there, or allow it to run in the shell? Any idea how we could read the return code of that with passing it in as a string 🤔?

@jamiekyle-eb
Copy link
Contributor Author

I've written a shell script to solve my need here:

index=0
split=-1

for arg in "$@"
do
  if [ "$arg" = '--' ]; then
    split=$index
    break
  fi
  index=$(expr $index + 1)
done

if [ $split -eq -1 ]; then
  echo "Invalid usage, expected: run-if condition -- command"
  exit 1
fi

cond=${@:0:$(expr $split + 1)}
cmd=${@:$(expr $split + 2)}

if eval $cond; then
  exec $cmd
fi

Which you can then run as:

bolt ws exec -- run-if [ -f tsconfig.json ] -- tsc

Maybe bolt could have something like this built in

@jamiekyle-eb
Copy link
Contributor Author

Never mind, the above script shits itself in different places

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