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

Custom printer support #1

Closed
wants to merge 2 commits into from
Closed

Conversation

technicalpickles
Copy link
Owner

I'd like to be able to use a custom printer from the command-line. Specifically, ruby-prof-speedscope.

I've extended the CLI to:

  • update --printer to allow a class name
  • add --printer-require for the file to require to use a printer

I ended up adding facets to get the String#modularize method. If this approach is generally acceptable, but an extra dependency isn't, I'm happy to extract copy it or ActiveSupport's implementation, similar to what is done for constantize

This allows the use of gems like https://github.com/chanzuckerberg/ruby-prof-speedscope :

- change `--printer` can take a class name instead of just a name of a builtin
- add `--printer-require` for a require for a printer
- add `load_printer` which is called during parse_args... after they are
  parsed, but before checking the output directory

I initially tried not adding --printer-require, and re-using
--require-noprof, but that didn't load the printer in time.
@technicalpickles
Copy link
Owner Author

oops, didn't target upstream ruby-prof#319

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