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 reading --doc and --metadata from file #4008
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
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.
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".
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.
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.
Activity
pekkaklarck commentedon Jun 9, 2021
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.
pekkaklarck commentedon Jul 5, 2021
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
--docand--metadatawhile 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.txtis that the user may want to usec:\example.txtas 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:example:c:\example.txtwould read contents from the file (assuming it exists) butexample: c:\example.txtwould 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".lesnake commentedon Jul 5, 2021
How about adding a
--doc-fileand--metadata-filearguments ?--metadata c:\example.txtcontinues working like it already does : set the meta datacto\example.txt--metadata-file c:\example.txtwould set all meta data contained into filec:\example.txt--doccontinues working like it already does.--doc-file c:\example.txtwould use all the content ofc:\example.txtfile as documentationIn any
-fileuse-case, if the file does not exist, an error should be returned.I think that this would:
--docand--metadataoption descriptionpekkaklarck commentedon Jul 5, 2021
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.
[-]Create top level documentation from external file[/-][+]Support reading `--doc` and `--metadata` from file[/+]