ygork / file-notes

0 stars 0 forks source link

Create command and argument parser #8

Open SeriyBg opened 7 years ago

SeriyBg commented 7 years ago

1) Create a class named RawCommand with fields String type and Map<String, String> arguments. 2) Create parser for RawCommand named CommandParser. For now you handle commands like create but you have to handle create --name CoolName --description Description. CommandParser will parse this string and and create a new RawCommand with type=create and args="name":"CoolName" "description":"Description"

SeriyBg commented 7 years ago

In parser you will have to split string like this commandString.split(" --") and you will receive arrays of string with values {"create", "name CoolName", "description Description"}

In this array firs element type="create" . To parse arguments use .split(" ") and on each argument where first element will be key of map and second element will be value for map.