Parse conf file for CLI tool

Hi,

I'm pretty new to ruby and want to program some some linux shell tools
in ruby as exercise. For these tools I want to be able to specify
options as parameters on the command line or in a config file.
I already discovered OptionParser to parse the command line options.

Can someone give me suggestions which classes to look at to simplify the
task of parsing a configuration file for options?

Regards,
mo

···

--
Posted via http://www.ruby-forum.com/.

harp:~ > cat a.rb
   #! /usr/bin/env ruby
   require 'yaml'

   config = 'config.yml'
   options = YAML.load(IO.read(config))
   y options

   harp:~ > cat config.yml

···

On Sat, 27 Jan 2007, Moritz Reiter wrote:

Hi,

I'm pretty new to ruby and want to program some some linux shell tools
in ruby as exercise. For these tools I want to be able to specify
options as parameters on the command line or in a config file.
I already discovered OptionParser to parse the command line options.

Can someone give me suggestions which classes to look at to simplify the
task of parsing a configuration file for options?

Regards,
mo

   ---
   key : value
   a : b

   harp:~ > ruby a.rb
   a: b
   key: value

-a
--
we can deny everything, except that we have the possibility of being better.
simply reflect on that.
- the dalai lama

That's exactly what I was looking for. Thanks!

···

--
Posted via http://www.ruby-forum.com/.