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

[DRAFT] - Add copy command #1044

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

Conversation

Prajjwal
Copy link

Closes #753

@Prajjwal Prajjwal force-pushed the sin.add-copy-command branch from 565421b to 7affd25 Compare December 11, 2024 20:56
HELP

def execute(arg)
output = irb_context.workspace.binding.eval(arg)
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to apply the output inspection method here so the copied output will be closer to what the users may expect.

For example, the output here by default will be the to_s result of the evaluation result, but IRB's default output inspector pretty prints the result inspect.

Additionally, we need to make sure colorizing is NOT applied to the copied value.

Copy link
Author

@Prajjwal Prajjwal Dec 16, 2024

Choose a reason for hiding this comment

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

The problem with using the pretty printer is that colorizing output is hardcoded into it, and I don't think we want it in our clipboard.

Unless there's a pretty printer that I've missed, the options are:

  1. Grab colorized output, strip color before copying. Least invasive, and will respect the currently configured inspector.
  2. Install a new pretty printer analogous to the default color printer that does basically the same thing but doesn't colorize output. Don't like this one because we're conflating two concepts and hardcoding a command to use a specific kind of inspection method.
  3. Like above, color_printer.rb to accept a parameter that turns colorizing on / off. Most invasive.

I like 1, but will defer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Explore the possibility to add a command to copy evaluation result
2 participants