<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -16,25 +16,21 @@
 #   ruby blob.rb retrieve a.rb        # =&gt; dumps a.rb to stdout
 #
 
-$: &lt;&lt; &quot;../lib&quot;
-$: &lt;&lt; &quot;../ext&quot;
 require 'rubygems'
-require 'arrayfields'
 require 'amalgalite'
-
+VALID_ACTIONS = %w[ list retrieve store ]
 def usage 
-  STDERR.puts &quot;Usage: #{File.basename($0)} ( store | retrieve )  file(s)&quot;
+  STDERR.puts &quot;Usage: #{File.basename($0)} ( #{VALID_ACTIONS.join(' | ')} )  file(s)&quot;
   exit 1
 end
 
 #
 # This does the basic command line parsing
 #
-usage if ARGV.size &lt; 2
+usage if ARGV.size &lt; 1
 action    = ARGV.shift
-usage unless %w[ store retrieve ].include? action
+usage unless VALID_ACTIONS.include? action 
 file_list = ARGV
-usage unless file_list.size &gt; 0
 
 #
 # create the database if it doesn't exist
@@ -55,6 +51,14 @@ end
 
 case action
   #
+  # list all the files that are stored in the database
+  #
+when 'list'
+  db.execute(&quot;SELECT path FROM files&quot;) do |row|
+    puts row['path']
+  end
+
+  #
   # if we are doing the store action, then loop over the files and store them in
   # the database.  This will use incremental IO to store the files directly from
   # the file names. 
@@ -67,6 +71,7 @@ case action
   # prepared statement.
   #
 when 'store'
+  usage if file_list.empty?
   db.transaction do |db_in_trans|
     db_in_trans.prepare(&quot;INSERT INTO files(path, data) VALUES( $path, $data )&quot;) do |stmt|
       file_list.each do |file_path|
@@ -91,6 +96,7 @@ when 'store'
   # positional sql varible binding using the '?' syntax.
   #
 when 'retrieve'
+  usage if file_list.empty?
   db.execute(&quot;SELECT id, path, data FROM files WHERE path = ?&quot;, file_list.first) do |row|
   STDERR.puts &quot;Dumping #{row['path']} to stdout&quot;
   row['data'].write_to_io( STDOUT )</diff>
      <filename>examples/blob.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>fa72067f59136bb92f3d333da91f1273f934afee</id>
    </parent>
  </parents>
  <author>
    <name>Jeremy Hinegardner</name>
    <email>jeremy@hinegardner.org</email>
  </author>
  <url>http://github.com/copiousfreetime/amalgalite/commit/af4db9b72c6142cd22c8b299c6b015c18fe3e6aa</url>
  <id>af4db9b72c6142cd22c8b299c6b015c18fe3e6aa</id>
  <committed-date>2008-07-04T13:30:40-07:00</committed-date>
  <authored-date>2008-07-04T13:30:40-07:00</authored-date>
  <message>added 'list' command to blob example program</message>
  <tree>4214af4b392943b65eccf6bbb3f34cf4cceb9e5d</tree>
  <committer>
    <name>Jeremy Hinegardner</name>
    <email>jeremy@hinegardner.org</email>
  </committer>
</commit>
