elgs / splitargs

Splits strings into tokens by given separator, treating quoted part as a single token.
17 stars 6 forks source link

paths? #2

Closed stevenvachon closed 9 years ago

stevenvachon commented 9 years ago

On OSX, the following command line:

node test.js asdf

produces the following value for process.argv:

["node","/path/to/test.js","asdf"]

while splitargs produces:

["node","test.js","asdf"]

Should paths be parsed?

elgs commented 9 years ago

I understand the convenience parsing the path would bring to the app, however, I don't think splitargs is responsible for parsing the path. I think this should be done by:

path.normalize('test.js');

if you required path.

stevenvachon commented 9 years ago

Sure, but that requires knowledge of which argument is a file and which isn't and is inconsistent with operating systems. But yeah, it's going beyond an "argument splitter". Perhaps an "argument normalizer" could be written if necessary -- I'm not even sure if it is or not.