Skip to content

string repeat does not process beyond the first argument #5988

Closed
@ssjhv

Description

@ssjhv

Fish version 3.0.2
OS: Debian Linux

string commands handle multiple arguments, e.g., "string length a bb ccc dddd" return four elements 1 2 3 4.

It looks like string repeat is an exception here.

~> string repeat -n 2 a bb ccc dddd
aa

It would be better if string repeat handles multiple arguments consistently with the other string commands.

(My motivation here is to use "string repeat -n 1 $var" as a way to return array $var. Currently one can either manually loop and echo, or use "string join \n $var", but loops are too long, and string join feels like it returns a single element, and automatic unpacking via newline split feels weird. I feel string repeat could be a good alternative to these.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions