README

NAME

Prompt::Expand - provide prompt expansion logic

SYNOPSIS

use Prompt::Expand;

say expand(":time: >");                     # 19:24:11 >

say expand(":yellow,date,reset: >", "NL");  # zon 19 jan 2025 >

DESCRIPTION

The Prompt::Expand distribution provides the logic to expand a string (usually intended to be used as a prompt for user input) according to number of escape sequences (\x) or placeholder specifications :text:. As such it exports an expand subroutine that takes such a format, and returns the expanded string.

Placeholders are specified by an initial semi-colon (:), followed by one or more identifiers separated by commas, and ended with a final semi-colon.

Expansion currently provided are:

  • ANSI color / formatting codes

  • strftime escape codes

  • emoji escape codes

  • other generally useful escapes

Expansions involving date / time values, can be localized by specifying the language to be used, either as a string (e.g. "NL") or as a custom Locale::Dates object.

EXPANSIONS

ANSI color codes

Note that not all of these are supported everywhere!

Raku escape sequences

Besides most of the standard Raku escape sequences with an associated :text: equivalent, also some other more interactive prompt related :text sequences:

From DateTime::strftime:

From Text::Emoji, all of the 1870 conversions are supported.

AUTHOR

Elizabeth Mattijsen [email protected]

Source can be located at: https://codeberg.org/lizmat/Prompt-Expand . Comments and Pull Requests are welcome.

If you like this module, or what I'm doing more generally, committing to a small sponsorship would mean a great deal to me!

COPYRIGHT AND LICENSE

Copyright 2025, 2026 Elizabeth Mattijsen

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.

Prompt::Expand v0.0.5

provide prompt expansion logic

Authors

  • Elizabeth Mattijsen

License

Artistic-2.0

Dependencies

Test Dependencies

Provides

  • Prompt::Expand

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.