How to prefix docstring of map with a space?

I’ve noticed that all of the following doesn’t preserve a prefix space of the docstring.
In other words first space gets trimmed.

map global user x nop -docstring ' test'
map global user x nop -docstring %{ test}

and this one literally puts <space>test

map global user x nop -docstring '<space>test'
map global user x nop -docstring %{<space>test}

Is there a way to preserve a prefix space?

Subsequent question why prefix space(s) gets trimmed?

I believe prefixed spaces get trimmed so that you can do things like:

define-command \
    -docstring "
         do-fancy-thing [<switches>]: Do a fancy thing.

         Switches:
             -foo         Do a foo.
             -bar         Order a drink.
    " \
    do-fancy-thing \
%{
    # ...
}

…and have that docstring actually show up with the proper indentation at runtime.

1 Like