On Sunday 14 October 2007 07:22 pm, ara.t.howard wrote:
> On Oct 14, 2007, at 1:43 PM, Randy Kramer wrote:
> > I'm in the process of writing a small utility in Ruby to convert  
> > files in one
> > format to a different format.
> >
> > Eventually it would be nice to to have the utility incorporate all  
> > or most of
> > the command line functionality and options of a command like cp,  
> > mv, or ln
> > (with suitable variations).  For example, it would be nice to  
> > invoke it in
> > any of 3 forms, like:
> >
> > cp [OPTION]... SOURCE DEST
> > cp [OPTION]... SOURCE... DIRECTORY
> > cp [OPTION]... --target-directory=DIRECTORY SOURCE...
> >
> > and to use many of the options available to cp like help, backup,  
> > force,
> > interactive, ...
> >
> > Is there a Ruby gem, library, class, or whatever that implements  
> > some or all
> > of that functionality?
> >
> > Randy Kramer
> 
> require 'fileutils'
> 
> FileUtils.mv src, dst

Ara,

Thanks!  You've answered the question I asked, but not the question I really 
intended to ask ;-), although your answer may be helpful anyway.

What I'm really looking for is a gem, library, class, or even just another 
utility written in Ruby (that I could use as a template) that processes 
command line parameters in a fashion like some typical *nix utilities (like 
maybe cp, ln, mv, ...).  

In other words, if I found such a utility written in Ruby, I'd think about 
leaving the "framework" that processes the command line parameters (like 
--help (-h), --force (-f), --interactive (-i), --backup and stripping out the 
code that performs the function of that utility, substituting the 
functionality I need.  (And changing the actions for the various command line 
parameters as appropriate.)

The code is probably not that hard to write, I just thought that if somebody 
had already written it, I could save some time and effort (assuming there 
were no licensing or copyright issues).

Randy Kramer