Comparing version 1.0.2 to 1.0.4
{ | ||
"name": "gps2json", | ||
"version": "1.0.2", | ||
"version": "1.0.4", | ||
"description": "CLI to pull photo meta GPS data into a JSON file", | ||
@@ -5,0 +5,0 @@ "main": "src/gps2json.js", |
@@ -6,3 +6,3 @@ #!/usr/bin/env node | ||
const process = require( "process" ); | ||
const app_root = require('app-root-path'); | ||
const app_root = require('app-root-path').path; | ||
const ExifImage = require('exif').ExifImage; | ||
@@ -18,7 +18,11 @@ const args = process.argv.filter((itm)=> { return !/\/bin\/gps2json/g.test(itm) && !/\/bin\/node/g.test(itm) ? itm : undefined}); | ||
for(option of Object.keys(options)){ | ||
const full_regex = new RegExp(`--${option}`, 'gi'); | ||
const shorthand_regex = new RegExp(`-${option.substring(0,1)}`, 'gi'); | ||
if(full_regex.test(args.join('')) || shorthand_regex.test(args.join(''))){ | ||
options[option] = args.filter((arg)=> { return full_regex.test(arg) || shorthand_regex.test(arg) ? arg : undefined})[0].split('=')[1]; | ||
options[option] = options[option].indexOf('./') > -1 ? path.join(path.dirname(require.main.filename).dir, options[option]) : options[option]; | ||
const full_opt = `--${option}` | ||
const short_opt = `-${option.substring(0,1)}`; | ||
if(args.join('').includes(full_opt) || args.join('').includes(short_opt)){ | ||
options[option] = args.filter((arg)=> { | ||
if(arg.includes(short_opt) || arg.includes(full_opt)){ | ||
return arg; | ||
} | ||
})[0].split('=')[1]; | ||
options[option] = options[option].indexOf('./') > -1 ? path.join(app_root, options[option]) : options[option]; | ||
} | ||
@@ -25,0 +29,0 @@ } |
25043464
9
47