Skip to content

Commit 9e53571

Browse files
committed
Support -g instead of --grep
1 parent 0af1849 commit 9e53571

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/irb/cmd/ls.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module IRB
1010
module ExtendCommand
1111
class Ls < Nop
1212
def self.transform_args(args)
13-
if match = args&.match(/\A(?<args>.+\s|)(--grep|-G)\s+(?<grep>[^\s]+)\s*\n\z/)
13+
if match = args&.match(/\A(?<args>.+\s|)(-g|-G)\s+(?<grep>[^\s]+)\s*\n\z/)
1414
args = match[:args]
1515
"#{args}#{',' unless args.chomp.empty?} grep: /#{match[:grep]}/"
1616
else

test/irb/test_cmd.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ def test_ls_grep
489489

490490
[
491491
"ls 42, grep: /times/\n",
492-
"ls 42 --grep times\n",
492+
"ls 42 -g times\n",
493493
"ls 42 -G times\n",
494494
].each do |line|
495495
out, err = execute_lines(line)
@@ -508,7 +508,7 @@ def test_ls_grep_empty
508508

509509
[
510510
"ls grep: /whereami/\n",
511-
"ls --grep whereami\n",
511+
"ls -g whereami\n",
512512
"ls -G whereami\n",
513513
].each do |line|
514514
out, err = execute_lines(line)

0 commit comments

Comments
 (0)