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

Run validation before any commands start running #100

Open
scotthovestadt opened this issue Feb 13, 2016 · 3 comments
Open

Run validation before any commands start running #100

scotthovestadt opened this issue Feb 13, 2016 · 3 comments

Comments

@scotthovestadt
Copy link
Contributor

Let's say I have the following commands:

file-read test.json | transform | file-write test.csv

In this use-case, let's say I want to validate the file extension before running a command. I add the validate method, but it won't run until after the whole file has been read in and transformed. In my use-case, that may take hours.

I'd like the validation to run immediately before any command starts running.

@dthree Any thoughts?

@dthree
Copy link
Owner

dthree commented Feb 13, 2016

It should run for a single command. Are you saying that the validate for specifically the piped commands doesn't happen? If so, yeah, that's a bit tricky. You would have to throw it in right around here:

https://github.com/dthree/vorpal/blob/master/lib/vorpal.js#L919

@scotthovestadt
Copy link
Contributor Author

Thanks for the pointer. I am going to implement this weekend. I need it.

My tool, each command can take several hours - days even. It renders a progress bar... but I really need to validate all commands in advance. Some of the validation involves HTTP calls.

@dthree
Copy link
Owner

dthree commented Feb 14, 2016

K got it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants