Skip to content

Support reading --doc and --metadata from file #4008

Closed

Description

@lesnake

I would like to add documentation using -D --doc argument followed with a file rather than a string of text, like
(rebot|robot) --doc topleveldoc.txt other args

The content of that file shall be any argument of --doc option

This issue replaces the issue #3983.

Activity

  1. added this to the v4.1 milestone on Jun 9, 2021
  2. pekkaklarck commented on Jun 9, 2021

    @pekkaklarck
    Member

    Sounds good to me. We already have #3860 about making it possible to provide multiline documentation from the command line, but being able to read it from a file would often be even more convenient.

  3. pekkaklarck commented on Jul 5, 2021

    @pekkaklarck
    Member

    I closed #3860 due to backwards incompatibility problems, it not providing too much benefits, and this issue helping with the same problem in more convenient way. That issue covered both --doc and --metadata while this issue so far concentrates only on the former, though. We thus need to extend this issue to cover also the latter.

    The problem with reading value from a file when using something like --metadata example:c:\example.txt is that the user may want to use c:\example.txt as the actual value. That's obviously true also with --doc c:\example.txt, but having only a path as a documentation sounds very unlikely. With metadata such usage is possible and we need to figure out how to make it possible. Some ideas:

    • We should read the value from a file only if the value points to an existing file. If the path doesn't exist, we should just it as the value as-is. This approach eases error handling in general. Someone may want to use a path pointing to an existing file as the value, though, so this doesn't solve the problem fully.
    • We could require metadata path given without a space after the colon. That way example:c:\example.txt would read contents from the file (assuming it exists) but example: c:\example.txt would not. This isn't the most convenient escaping mechanism and obviously isn't intuitive either, but at least it would allow escaping if needed. I would assume that reading the value from a file would be the common case so the common format without spaces should support that. This way also documentation only containing a path could be used with a leading space like --doc " c:\example.txt".
  4. lesnake commented on Jul 5, 2021

    @lesnake
    Author

    How about adding a --doc-file and --metadata-file arguments ?
    --metadata c:\example.txt continues working like it already does : set the meta data c to \example.txt
    --metadata-file c:\example.txt would set all meta data contained into file c:\example.txt
    --doc continues working like it already does.
    --doc-file c:\example.txt would use all the content of c:\example.txt file as documentation
    In any -file use-case, if the file does not exist, an error should be returned.

    I think that this would:

    • not require risky deduction on the value read (is it a file name ? does it exist ?)
    • don't change existing --doc and --metadata option description
    • new arguments documentation simpler to read without bloating the CLI.
  5. pekkaklarck commented on Jul 5, 2021

    @pekkaklarck
    Member

    I don't think adding new options is worth the effort. The basic usage for reading doc/metadata from a file is pretty intuitive and easy to learn and use. Only escaping, which ought to be rarely needed, requires somewhat strange syntax. I'm also more worried that having too many different options bloats the CLI.

  6. changed the title [-]Create top level documentation from external file[/-] [+]Support reading `--doc` and `--metadata` from file[/+] 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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions