[Rubygems-developers] [PATCH] Two changes to the gem list command

Martin Krauskopf martin.krauskopf at gmail.com
Sun Aug 3 05:13:22 EDT 2008

Bjørn Arild Mæland wrote:
 >   Hi,
 >   I've made a couple of very small patches that deals with the list
 >   command.
 >   The first patch [1] causes the list command to exit 1 if "gem list
 >   <pattern>" has no results.

But the patch does not differ between:

  $ gem list # on *empty* repository
  $ echo $?  # => 1 but should be 0 in this case


  $ gem list abcd_not_exists
  $ echo $?  # => 1 is correct

which is how e.g. 'ls' behaves. 'ls' on empty dir has no result and
exist with 0. But ls on non-matching pattern returns 1.

Thus tweaking condition in QueryCommand#output_query_results like shown
in http://pastie.org/246474 (there is probably better way then
'/^/i == options[:name]' for check whether user actually specified
pattern on CLI).

Also 'ls' shows error in the case there is no matching pattern when the
pattern is given. Might be such approach would be taken?

   $ ls abcd_not_exists
   ls: cannot access abcd_not_exists: No such file or directory


More information about the Rubygems-developers mailing list