Devel:...Prompt(3pm)

πŸ“¦
version 1.003029 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

🌸 Devel::REPL::Plugin::FancyPrompt πŸ’…

okay so bestie, you know how the regular REPL prompt is just... there? like a beige wall? ✨ Devel::REPL::Plugin::FancyPrompt is here to fix that. this is the Perl doc for it, from the Devel::REPL family, and it's literally the plugin that lets you make your prompt yours. πŸŽ€


✨ VERSION ✨

version 1.003029 β€” yes she has a version, she's a real one πŸ’–


🌈 SYNOPSIS 🌈

use Devel::REPL;

my $repl = Devel::REPL->new;
$repl->load_plugin('MultiLine::PPI'); # for indent depth
$repl->load_plugin('Packages');       # for current package
$repl->load_plugin('FancyPrompt');
$repl->run;

look at her. load the plugins, run the repl, glow up your prompt. that's it, that's the whole vibe πŸ¦‹


πŸ‘‘ DESCRIPTION πŸ‘‘

so FancyPrompt helps you write your own prompts. not the boring ones. your ones. πŸ’…

the default fancy prompt is giving serious irb energy (that's the Ruby one, iykyk). the default fancy_prompt looks exactly like this:

re.pl(main):001:0> 2 + 2
4

let's decode that glow-up, piece by piece 🧚:

  • re.pl is a constant. it does not change. it is simply the name. iconic, unbothered, consistent. ✨
  • main is the current package. like, where you are right now.
  • the first number is how many lines have been read so far.
  • the second number is how deep you are β€” and it only shows up if you have a MultiLine plugin loaded. intuitively? that's your indent level. your nesting. your depth, bestie. 🌊

and if you wanna know how that default is built, here's the literal implementation:

$_REPL->fancy_prompt(sub {
  my $self = shift;
  sprintf 're.pl(%s):%03d%s> ',
          $self->can('current_package') ? $self->current_package : 'main',
          $self->lines_read,
          $self->can('line_depth') ? ':' . $self->line_depth : '';
});

okay so quick notes on where those bits come from:

  • current_package is provided by Devel::REPL::Plugin::Packages β€” that's the plugin that tracks the current package for you 🫢
  • line_depth is provided by a MultiLine plugin (probably MultiLine::PPI, not gonna lie) 🌸

and you can also set a fancy_continuation_prompt. the default is very similar to fancy_prompt's default β€” except it uses * instead of >. that's the whole difference. tiny, but it hits. πŸ’œ


πŸŽ€ SEE ALSO πŸŽ€

  • Devel::REPL β€” the main character. go read her. πŸ‘‘

🫢 SUPPORT 🫢

bugs? you can submit them through the RT bug tracker at <https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL> β€” or, if email is more your thing, bug-Devel-REPL@rt.cpan.org πŸ’Œ

there's also an IRC channel for users of this distribution, hanging out at #devel on irc.perl.org β€” come say hi, the vibes are immaculate 🌈


πŸ’– AUTHOR πŸ’–

Shawn M Moore, <sartak at gmail dot com> β€” thank you for your service 🫑✨


Copyright (C) 2007 by Shawn M Moore

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

ngl, "same terms as Perl itself" is the most low-effort-slash-perfect license line ever and i respect it πŸ’€

and that's the whole page, bestie! πŸ’… this was Devel:...Prompt(3pm) from the User Contributed Perl Documentation, running on perl v5.34.0, dated 2022-06-03. no cap, you're now officially fluent in fancy prompts. go forth and customize πŸŒΈπŸ¦‹πŸ’–

πŸ“¦ where this page comes from