Mercurial > octave
changeset 33501:d8a3473c107a
print_usage.m: Make output look cosmetically like Texinfo
* print_usage.m: Add leading " --" after certain newlines to imitate
the output of `help ()`.
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Wed, 01 May 2024 16:31:05 -0400 |
parents | 952bb22874fd |
children | 93ed5f5a8123 747b9a4bc70c |
files | scripts/help/print_usage.m |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/help/print_usage.m Wed May 01 21:25:43 2024 +0200 +++ b/scripts/help/print_usage.m Wed May 01 16:31:05 2024 -0400 @@ -221,6 +221,16 @@ buffer = strrep (buffer, guardstring, "@"); endif + ## Optional: Try inserting " --" after newlines to imitate Texinfo visually. + ## This makes `help foo` and plain `foo` look similar. + do + ## First remove extra spaces; otherwise they interfere. + old = numel (buffer); + buffer = strrep (buffer, " ", " "); + until (numel (buffer) == old); + buffer = [" --", buffer]; + buffer = strrep (deblank (buffer), "\n", "\n --"); + retval = buffer; status = 0; # == success endfunction