Skip to content

Commit

Permalink
fix: stock previously not working country param
Browse files Browse the repository at this point in the history
  • Loading branch information
Ephigenia committed Aug 19, 2020
1 parent 0292fc1 commit b24ffff
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions source/cli-stock.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,17 @@ program
productIds = productIds.filter(function(cur, i, arr) {
return arr.indexOf(cur, i + 1) === -1;
});

// TODO when empty countryCodes, use countries derived from store id and
// store
// @var {String}
let stores = [];
if (!program.store && program.countryCode) {
stores = storesData.findByCountryCode(program.countryCode);
if (!program.store && program.country) {
stores = storesData.findByCountryCode(program.country);
} else if (Array.isArray(program.store)) {
stores = storesData.getStoresById(program.store);
} else if (program.store) {
stores = storesData.getStoresMatchingQuery(program.store, program.countryCode);
stores = storesData.getStoresMatchingQuery(program.store, program.country);
} else {
console.error('please provide country code and/or store id');
process.exit(1);
Expand Down

0 comments on commit b24ffff

Please sign in to comment.