User-Choices 1.1.0 released

User-Choices is a unified interface to configuration files, command-line options and arguments, and the environment. Here’s the beginning of the tutorial:

Suppose you have a command-line application that uses some number of, oh, let’s say “connections”. Most of the time, a user will want the same number of connections, so you’ll let them set a personal default in a configuration file. Sometimes they want to change the default. Maybe they’ll want a one-time change; for that, a command-line option is best. But sometimes they’ll want to make the change for an entire login session; for that, setting an environment variable is most convenient.

The User-Choices gem gives your code a unified interface to all those sources. Your code can obey the user’s choices without having to bother (much) about how she made them.

This version is derived from the one used in Part 4 of Everyday Scripting with Ruby. However, there are minor incompatible changes to the interface. Sorry about that. In return, you can now use YAML for configuration files, and empty argument lists are handled more gracefully when choices can also be made in the environment or a config file.

One Response to “User-Choices 1.1.0 released”

  1. bret Says:

    Here’s how we’re using user-choices with our Watir test suite.

Leave a Reply

You must be logged in to post a comment.