Skip to content

[FEATURE] file validators should handle stdin and stdout properlyΒ #124

@h-2

Description

@h-2

Does this problem persist on the current main?

  • I have verified the issue on the current main

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Passing "-" to an input_file_validator fails with

what():  Validation failed for positional option 1: The file "-" does not exist!`

Passing "/dev/stdin" also fails:

what():  Validation failed for positional option 1: Expected a regular file "/dev/stdin"!

Expected Behavior

Both of these values should work.

Both of them should also be exempt from extension-checks (or there should be another validator called input_file_or_stdin_validator or maybe even just input_validator because it covers all possible inputs?).

P.S.: independent of "/dev/stdout", I think it is too restrictive to only allow regular files. Being able to open FIFOs is useful, too.

Steps To Reproduce

try it :)

Environment

- Operating system: Ubuntu 22.04
- Sharg version: 89bb8e71172ceea20b95beed5e071fe62b13d91c
- Compiler: gcc-11.3

Anything else?

I like the config being switched to designated initialisers πŸ‘πŸ»

Suggestion: the documentation would be easier to read if validators and exceptions were in their own folder, because there would be fewer items cluttering the top-level of the documentation. They could even have their own namespace (sharg::validator::input_file ...).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions