Skip to content

the goal of this kata is to learn to work incrementally by implementing a cli arguments parser.

License

Notifications You must be signed in to change notification settings

nemax23/cli-args-parser-kata

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KATA SOLUTION

To test the solution just

node main.js

and type any argument to test the parsing result. Both string and array are supported. Some basic validation is performed and may be improved to better check malformed/wrong inputs.

Some examples

node main.js
bar    
Parsing result: {}
--bar
Parsing result: {"bar":true}
--foo bar
Parsing result: {"foo":"bar"}
--foo bar bar2 bar3
Parsing result: {"foo":["bar","bar2","bar3"]}
--foo bar --foo2 1 2 --foo bar2 bar3 --foo2
Parsing result: {"foo":["bar","bar2","bar3"],"foo2":[1,2]}
--foo bar --foo2 1 2 --foo bar2 bar3 --foo3
Parsing result: {"foo":["bar","bar2","bar3"],"foo2":[1,2],"foo3":true}
[--bar]
Parsing result: {"bar":true}
[--bar4,--bar2,--bar3,foo,foo2,--bar2,3,--bar]
Parsing result: {"bar4":true,"bar2":3,"bar3":["foo","foo2"],"bar":true}
[--foo, --foo2, test, test2, --bar, --foo, 2]
Parsing result: {"foo":2,"foo2":["test","test2"],"bar":true}

About

the goal of this kata is to learn to work incrementally by implementing a cli arguments parser.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%