Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display aliases in help message #788

Merged
merged 1 commit into from
Nov 26, 2023
Merged

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Nov 25, 2023

Similar to Pry, it displays aliases in the help message with a dedicated section. With the current default aliases, it looks like:

...other sections...

Aliases
  $              Alias for `show_source`
  @              Alias for `whereami`

Addresses a point in #775

show_cmds doesn't show any of the aliases.

@st0012 st0012 added the enhancement New feature or request label Nov 25, 2023
@@ -16,6 +16,12 @@ def execute(*args)
commands_info = IRB::ExtendCommandBundle.all_commands_info
commands_grouped_by_categories = commands_info.group_by { |cmd| cmd[:category] }

user_aliases = irb_context.instance_variable_get(:@user_aliases)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's purely internal and only for this command at the moment, I don't plan to expose an API for it.

And I don't directly read IRB.conf[:COMMAND_ALIASES] here because if the user updates it in the session, help message and the actual behaviour will be out of sync.

Similar to Pry, it displays user-defined aliases in the help message with
a dedicated section. With the current default aliases, it looks like:

```
...other sections...

Aliases
  $              Alias for `show_source`
  @              Alias for `whereami`
```
@st0012 st0012 force-pushed the list-aliases-in-help-message branch from d8a9833 to acff99f Compare November 26, 2023 11:07
@st0012 st0012 requested a review from tompng November 26, 2023 11:09
@tompng tompng merged commit 2a0eacc into master Nov 26, 2023
43 of 47 checks passed
@tompng tompng deleted the list-aliases-in-help-message branch November 26, 2023 17:07
matzbot pushed a commit to ruby/ruby that referenced this pull request Nov 26, 2023
(ruby/irb#788)

Similar to Pry, it displays user-defined aliases in the help message with
a dedicated section. With the current default aliases, it looks like:

```
...other sections...

Aliases
  $              Alias for `show_source`
  @              Alias for `whereami`
```

ruby/irb@2a0eacc891
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

2 participants