dthree / vorpal

Node's framework for interactive CLIs

Home Page:http://vorpal.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to get vorpal argument as an array

zelaxo opened this issue · comments

Vorpal arguments are returned as a string. How to get them as it is, ie. get an object array as an object array.

Please refer here for a broader explanation : https://stackoverflow.com/q/53297013/8619824

@zaygozi it should be command <arg...> according to the documentation, are called variadic arguments

@b4dnewz But variadic arguments return an array of strings. So if the input is {name:'anon',time:9}, this is returned as a type string & not an object. The only way I found to resolve this was to pass the input as a json object {"name":"arjun","time":9} & then use JSON.parse to retrieve the object from the string.