I
I
Ivan Ivanov2020-11-14 14:09:53
Debian
Ivan Ivanov, 2020-11-14 14:09:53

How to escape hyphen on command line for Puppeteer, node, minimist?

You need to run something like this:

node some_script.js --param_1 '37.7790262' --param_2 '-122.419906' --param_3 'blablabla'

The problem is that '-122.419906' is not being passed to the script.
var argv = require('minimist')(process.argv.slice(2));
console.dir(argv);


param_1: 37.7790262,
param_2: true,
param_3: blablabla,


If you simply send 122.419906 without a hyphen, then everything is ok.
How to be? Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question