I am building a spring boot based command line utility written in java for teams in my organization. I will have to allow teams to pass arbitrary command line args that can contain spaces.
I tried looking up any third party libraries or libraries from Spring that can do this but I am not able to find any that can can parse args the way I want it.
java -jar client.jar --args='a=Car b=Truck c="Car faster than Truck" d="Car faster than all"'
In my command line utility I would like to get the args.
a=Car
b=Truck
c=Car faster than Truck
d=Car faster than all
I tried using regex to split by spaces and as you can tell it wouldnt work. I think splitting it based on spaces wouldnt work too.
What would be the efficient way to parse these args?
1