Browse Source

fix --home not working. found a known bug in 3rd party lib, so sad.

Henry Jameson 4 years ago
parent
commit
295d93cbc4
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      index.js

+ 4
- 4
index.js View File

@@ -6,15 +6,15 @@ const CustomerListFromURL = require('./lib/CustomerListFromURL.js')
6 6
 
7 7
 program
8 8
   .version('0.0.1')
9
-  .option('--customers [url]', 'URL for customers list [by default uses the URL provided in email ;)].', 'https://s3.amazonaws.com/intercom-take-home-test/customers.txt')
10
-  .option('--home [home]', '"Home" location - distances to customers will be calculated against it [Default is [-6.257664, 53.339428]].', [-6.257664, 53.339428])
9
+  .option('--customers [url]', 'URL for customers list.', 'https://s3.amazonaws.com/intercom-take-home-test/customers.txt')
10
+  .option('--home [home]', '"Home" location - distances to customers will be calculated against it. Please prepend negative values with space, like so: --home " -1,2"', '-6.257664, 53.339428')
11 11
   .option('--no-orm', 'Disables fetching distance via OpenRouteMap.')
12 12
   .option('--direct-routes', 'Fall back to simple calculation if ORM tells there are no routes.')
13
-  .option('-d, --distance [meters]', 'Maximum exclusive distance in meters [100000]', 100000)
13
+  .option('-d, --distance [meters]', 'Maximum exclusive distance in meters', 100000)
14 14
   .parse(process.argv)
15 15
 
16 16
 const customerListFromURL = new CustomerListFromURL(program.customers)
17
-const customerFinder = new CustomerFinder(customerListFromURL, program.home, { noORM: !program.orm, fallbackOnInfinity: program.directRoutes })
17
+const customerFinder = new CustomerFinder(customerListFromURL, program.home.split(','), { noORM: !program.orm, fallbackOnInfinity: program.directRoutes })
18 18
 
19 19
 console.log('Processing...')
20 20
 customerFinder.findNearestCustomers(program.distance).then(customers => {