Skip to content

Support multiline values with --doc and --medadata #3860

Closed

Description

@Robot8206

Hi,

Is there any possibility to add metadata with multiple lines?
i already tried following command line:

  • rebot -o output1.xml -l log1.html -r NONE -M test:line1\nline2 output.xml

bast it doesn't work.

I am using the rebot version 3.2.2.

thanks!

Activity

  1. changed the title [-]rebot --metadata newline[/-] [+]rebot --metadata multiple lines[/+] on Feb 19, 2021
  2. pekkaklarck commented on Feb 22, 2021

    @pekkaklarck
    Member

    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.

  3. Robot8206 commented on Feb 22, 2021

    @Robot8206
    Author

    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?

  4. pekkaklarck commented on Feb 22, 2021

    @pekkaklarck
    Member

    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.

  5. changed the title [-]rebot --metadata multiple lines[/-] [+]Support multiline values with `--doc` and `--medadata`[/+] on Feb 22, 2021
  6. pekkaklarck commented on Feb 22, 2021

    @pekkaklarck
    Member

    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.

  7. Robot8206 commented on Feb 22, 2021

    @Robot8206
    Author

    Great :) thanks for your support

  8. added this to the v4.1 milestone on Feb 26, 2021
  9. pekkaklarck commented on Feb 26, 2021

    @pekkaklarck
    Member

    This is a useful enhancement but not important enough for RF 4.0 that's already pretty late. Added to RF 4.1 scope.

  10. pekkaklarck commented on Jul 5, 2021

    @pekkaklarck
    Member

    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.

  11. added and removed
    good first issue
    on Jul 5, 2021
  12. removed this from the v4.1 milestone on Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions