Skip to content

Would this work for checking if delivery is possible? #34

Answered by Ephigenia
jkatsnelson asked this question in Q&A
Discussion options

You must be logged in to vote

The stock sub-command enables searching for multiple stores and products and could use the exit-code as a hint for all (or just a single) products being available or not. I’m not sure if that would be good practice for a CLI tool to misuse the exit code that way.

That’s why I’d suggest using an additional CLI tool for checking the output of the stock command as it gives you much more flexibility on how you want to check what.

So for simply checking if a single product is availble you could use the json output and jq (one of the standard tools for json processing in the cli) to check the availability.stock value like so:

npm run start -s -- stock --store=155 --reporter json S69022537 | jq …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@jkatsnelson
Comment options

@Ephigenia
Comment options

@Ephigenia
Comment options

Answer selected by Ephigenia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants