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

Add Reline autocomplete prompt behind feature flag #19403

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sjanusz-r7
Copy link
Contributor

This PR builds on the Readline to Reline refactor here: #19397

This PR adds a new feature flag, that when enabled, will result in valid options that can be tab-completed to be shown below the currently typed text, same as IRB.

This PR should have no technical impact as it only changes how the UI is presented. It does not change valid tab complete options.

Currently putting this up as a draft but will convert to a normal PR without the initial Readline -> Reline commit once it is merged.

Before

  • Tab completion works, but is different from the nice approach of e.g. IRB:
image

After

  • We see valid auto-complete options that can be chosen/toggled between by pressing tab:
image
  • We can have nested auto-completions:
image
  • We can also auto-complete the valid values for options:
image
  • For example, the path option can auto-complete files from disk, the bool option can default to true/false etc.
image

Verification

  • Boot up msfconsole
  • Ensure tab-completion continues to work

{
name: SHOW_AUTOCOMPLETION_PROMPT,
description: 'When enabled, an autocompletion prompt will be shown when typing in commands',
requires_restart: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this could be false if we update def set(name, value) to have a set-effect like it does for wrapped tables

@adfoster-r7
Copy link
Contributor

This might add a lot of overhead/noise across the wire to remote targets if this impacts Meterpreter shells

@@ -28,6 +28,7 @@ class FeatureManager
MSSQL_SESSION_TYPE = 'mssql_session_type'
LDAP_SESSION_TYPE = 'ldap_session_type'
SHOW_SUCCESSFUL_LOGINS = 'show_successful_logins'
SHOW_AUTOCOMPLETION_PROMPT = 'show_autocompletion_prompt'
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem like the right feature flag name; maybe we just name it what it is:

Suggested change
SHOW_AUTOCOMPLETION_PROMPT = 'show_autocompletion_prompt'
USE_RELINE = 'use_reline'

Copy link
Contributor

Choose a reason for hiding this comment

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

Also happy with other names, but show_autocompletion_prompt isn't what this PR does anymore I don't think 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the other cherry-picked commit. The PR now does what it says, but I will need to circle back to it after the Reline library has been merged. Leaving it as draft for now 👍

@sjanusz-r7 sjanusz-r7 force-pushed the reline-autocomplete-prompt-behind-feature-flag branch from 9591233 to 848811e Compare November 18, 2024 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants