Is there a way to have optional flag values? Something like the following:
const arg = require('arg');
const args = arg({
'--port': Number, // --port <number>
'--host': String.optional, // --host [string]
});
Given --port 5432 --host localhost it should return { _: [], port: 5432, host: 'localhost' },
given --port 5432 --host it should return something like { _: [], port: 5432, host: true },
and given --port 5432 it should return { _: [], port: 5432 },
Is there a way to have optional flag values? Something like the following:
Given
--port 5432 --host localhostit should return{ _: [], port: 5432, host: 'localhost' },given
--port 5432 --hostit should return something like{ _: [], port: 5432, host: true },and given
--port 5432it should return{ _: [], port: 5432 },