I'm currently working on a CLI app in Ruby, I'm using Trollop (http://trollop.rubyforge.org/) for dealing with cli arguments.
I'd also like to implement the possibility of storing the required options in ~/.mycfg as well as cwd/.mycfg, the latter taking precedence.
The behaviour I'm trying to implement is:
If .mycfg exists in the current working directory, load default options from there, otherwise, if it exists in the user's home directory, load options from there.
I will then override those options if they are also passed as arguments.
The question is, what format should the config file be in? I've thought about YAML, but then how to I merge the array that Trollop generates for the parameters with the YAML, or the other way around.