You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support multiline values with --doc and --medadata #3860
This isn't currently possible, but supporting it shouldn't be too complicated. Notice that if \n was to be treated like it's treated in test data, line 1\nline 2 would nevertheless be rendered as a single paragraph without a newline. You would be able to use - item 1\n- item 2 to get a list, though. I'm not sure is this worth the effort.
even when i tried rebot --metadata test:"- item 1\n- item2", i still getting just one line(list with 1 line).
is there any plan to support this feature in the future?
Yeah, at the moment \n isn't considered a newline in this context. We could change that but I wanted to note that first\nsecond would still be rendered like first second, not as two lines. Creating lists like - first\n- second and also paragraphs like first\n\nsecond would be possible, though.
I don't personally consider this too high priority with --metadata, but the same issue affects also --doc and that I consider more important. I'm not sure is that important enough for RF 4, though, but I may still take a bit deeper look at it. Could be done in some future release anyway.
One thing to notice is that if we consider \n newline in this context, it basically means we use \ as an escape character and that means using it e.g. like c:\example\path won't work. It would need to be doubled like c:\\example\\path which isn't a huge problem but makes this a backwards incompatible change anyway.
After thinking this more, I believe this enhancement isn't worth the backwards incompatibility problems it has. Here's why:
Due to how Robot handles paragraphs in documentation, multiline documentation only really works if you have multiple paragraphs, lists, tables or preformatted text. All these are pretty complex structures to use from the command line. Benefits of this enhancement would thus be rather small.
Anyone using \ in their documentation or metadata (e.g. Widows paths) needed to escape it. This is the main backwards incompatibility problem.
If the documentation contains actual newlines, they work just fine already now. The problem is that injecting newlines is shell dependent. For example, on bash it's possible to use --metadata $'test:- list with\n- two items' or just wrap the value in quotes and press enter where a newline is needed. I assume something similar works with other unixy shells, but I don't have any idea what would work on Windows.
We have Support reading --doc and --metadata from file #4008 about reading documentation from an external file. The idea is that you can use --doc doc.txt and, assuming the file exists, documentation will be read from doc.txt. With longer docs that's a lot more convenient than passing the value from the command line directly. The only problem is that someone could have possibly used --metadata path:c:\example.txt so that c:\example.txt is the actual value. Now if that file exists, you'll see its contents instead. This is the reason why Support reading --doc and --metadata from file #4008 covers only documentation, but I think we can come up with some escaping mechanism and extend it also to metadata.
Due to the above reasons I close this issue as WontFix and concentrate on #4008. If someone disagrees, please comment this issue. If there are good use cases for this functionality that aren't covered by #4008, we can consider reopening this issue.
Activity
[-]rebot --metadata newline[/-][+]rebot --metadata multiple lines[/+]pekkaklarck commentedon Feb 22, 2021
This isn't currently possible, but supporting it shouldn't be too complicated. Notice that if
\nwas to be treated like it's treated in test data,line 1\nline 2would nevertheless be rendered as a single paragraph without a newline. You would be able to use- item 1\n- item 2to get a list, though. I'm not sure is this worth the effort.Robot8206 commentedon Feb 22, 2021
even when i tried
rebot --metadata test:"- item 1\n- item2", i still getting just one line(list with 1 line).is there any plan to support this feature in the future?
pekkaklarck commentedon Feb 22, 2021
Yeah, at the moment
\nisn't considered a newline in this context. We could change that but I wanted to note thatfirst\nsecondwould still be rendered likefirst second, not as two lines. Creating lists like- first\n- secondand also paragraphs likefirst\n\nsecondwould be possible, though.I don't personally consider this too high priority with
--metadata, but the same issue affects also--docand that I consider more important. I'm not sure is that important enough for RF 4, though, but I may still take a bit deeper look at it. Could be done in some future release anyway.[-]rebot --metadata multiple lines[/-][+]Support multiline values with `--doc` and `--medadata`[/+]pekkaklarck commentedon Feb 22, 2021
One thing to notice is that if we consider
\nnewline in this context, it basically means we use\as an escape character and that means using it e.g. likec:\example\pathwon't work. It would need to be doubled likec:\\example\\pathwhich isn't a huge problem but makes this a backwards incompatible change anyway.Robot8206 commentedon Feb 22, 2021
Great :) thanks for your support
pekkaklarck commentedon Feb 26, 2021
This is a useful enhancement but not important enough for RF 4.0 that's already pretty late. Added to RF 4.1 scope.
pekkaklarck commentedon Jul 5, 2021
After thinking this more, I believe this enhancement isn't worth the backwards incompatibility problems it has. Here's why:
\in their documentation or metadata (e.g. Widows paths) needed to escape it. This is the main backwards incompatibility problem.--metadata $'test:- list with\n- two items'or just wrap the value in quotes and press enter where a newline is needed. I assume something similar works with other unixy shells, but I don't have any idea what would work on Windows.--docand--metadatafrom file #4008 about reading documentation from an external file. The idea is that you can use--doc doc.txtand, assuming the file exists, documentation will be read fromdoc.txt. With longer docs that's a lot more convenient than passing the value from the command line directly. The only problem is that someone could have possibly used--metadata path:c:\example.txtso thatc:\example.txtis the actual value. Now if that file exists, you'll see its contents instead. This is the reason why Support reading--docand--metadatafrom file #4008 covers only documentation, but I think we can come up with some escaping mechanism and extend it also to metadata.Due to the above reasons I close this issue as WontFix and concentrate on #4008. If someone disagrees, please comment this issue. If there are good use cases for this functionality that aren't covered by #4008, we can consider reopening this issue.