Skip to content

trunc a template string #352

@nimaaskarian

Description

@nimaaskarian

hey. i have been reading the manpages, the github readme and issues but i haven't found a way to truncate a format string; something like below (assuming $player is defined):

playerctl -F -p "$player" metadata --format '{{trunc("{{artist}} - {{title}} {{status}}", 50)}}'

my dwmblocks has a stack allocated array of size 50. and i really don't want the music status to be longer than that, without this option i have to call to head and truncate the output of the format string.

i think it would be amazing if there was a function that'd explicitly resolve the format strings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions