Skip to content

Commit

Permalink
Rename banner to help_message
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 committed Feb 17, 2024
1 parent 90eb545 commit 3170d26
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/irb/command/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def description(description = nil)
@description
end

def banner(banner = nil)
@banner = banner if banner
@banner
def help_message(help_message = nil)
@help_message = help_message if help_message
@help_message
end

private
Expand Down
4 changes: 2 additions & 2 deletions lib/irb/command/edit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Command
class Edit < Base
category "Misc"
description 'Open a file or source location.'
banner <<~BANNER
help_message <<~HELP_MESSAGE
Usage: edit [FILE or constant or method signature]
Open a file in the editor specified in #{highlight('ENV["VISUAL"]')} or #{highlight('ENV["EDITOR"]')}
Expand All @@ -24,7 +24,7 @@ class Edit < Base
edit foo.rb
edit Foo
edit Foo#bar
BANNER
HELP_MESSAGE

class << self
def transform_args(args)
Expand Down
2 changes: 1 addition & 1 deletion lib/irb/command/help.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def execute(command_name = nil)
content =
if command_name
if command_class = ExtendCommandBundle.load_command(command_name)
command_class.banner || command_class.description
command_class.help_message || command_class.description
else
"Can't find command `#{command_name}`. Please check the command name and try again.\n\n"
end
Expand Down
4 changes: 2 additions & 2 deletions lib/irb/command/ls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class Ls < Base
category "Context"
description "Show methods, constants, and variables."

banner <<~BANNER
help_message <<~HELP_MESSAGE
Usage: ls [obj] [-g [query]]
-g [query] Filter the output with a query.
BANNER
HELP_MESSAGE

def self.transform_args(args)
if match = args&.match(/\A(?<args>.+\s|)(-g|-G)\s+(?<grep>[^\s]+)\s*\n\z/)
Expand Down

0 comments on commit 3170d26

Please sign in to comment.