Getting the value from command line input, command-line-args NPM module, node.js/javascript -


i use code add -find flag, can't find how value in useable variable.

const commandlineargs = require('command-line-args') const quicksearch = [ {name: 'find', alias: 'f',type: string} ]  

i'd achieve in terminal, -find=github, use value of find flag, in useable variable, can emit server, i've read docs theres nothing it.

run @ command-promt/bash like:

node test.js -f github or

node test.js --find github or

node test.js --find=github

expect output:

{ find: 'github' }

server/javascript file (test.js):

var commandlineargs = require('command-line-args')  const optiondefinitions = [   { name: 'find', alias: 'f', type: string } ]  const options = commandlineargs(optiondefinitions)  console.log(options);  //options.find equal 'github' 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -