1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Merge pull request #2120 from barrettkingram/fix-help-command-listing

Improve appearance of help command listing
This commit is contained in:
Kyrylo Silin 2020-04-12 15:17:32 +08:00 committed by GitHub
commit 7a4166fb04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View file

@ -193,7 +193,7 @@ class Pry
options = original_options.merge!(
desc: "Alias for `#{action}`",
listing: match
listing: match.is_a?(String) ? match : match.inspect
).merge!(options)
# ensure default description is used if desc is nil

View file

@ -6,7 +6,7 @@ class Pry
match(/^\s*!\s*$/)
group 'Editing'
description 'Clear the input buffer.'
command_options use_prefix: false
command_options use_prefix: false, listing: '!'
banner <<-'BANNER'
Clear the input buffer. Useful if the parsing process goes wrong and you get

View file

@ -185,11 +185,16 @@ RSpec.describe Pry::CommandSet do
expect(new_command.description).to eq('Alias for `test`')
end
it "sets aliased command's listing" do
it "sets aliased command's listing for string alias" do
new_command = subject.alias_command('new-test', 'test')
expect(new_command.options).to include(listing: 'new-test')
end
it "sets aliased command's listing for regex alias" do
new_command = subject.alias_command(/test[!?]+/, 'test')
expect(new_command.options[:listing].to_s).to eq('/test[!?]+/')
end
it "sets group for the aliased command automatically" do
new_command = subject.alias_command('new-test', 'test')
expect(new_command.group).to eq('Aliases')