Browser JS argument parser

Question:

I am making a js CLI emulator and i need a command parser that will be able to parse arguments that are surronded with “” so what i need it to do if the in put is help "test command" to return['help', 'test command'] and NOT ['help', '"test', 'command"']

Repl link:
https://replit.com/@1gn/CLIExtension

1 Like

can’t you just do like split the string by " " and then join the rest of the string together??

2 Likes

hmm the only problem i see is escaped " but i dont think i will run into thoose to much

2 Likes

ye also sometimes you will need the " specifications just to parse if it’s an int or not. That’s basically the job of the cli package so yeah… Also, please mark my thing as solved

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.