Skip to content

Issue when using - as stdin and stdout #213

Open

Description

@carstencodes

Hi,

thanks for your nice work.

I have an issue when I declare my arguments as follows:

-f --format (output format)
-o --output (output file, - is supported for using stdout)
input-file (input file, - is supported for stdin)

But when I run my app as follows,

app -f json -o - input.file

then - is used as input-file and input.file is bound to -o.

This is rather unexpected.

Activity

  1. added
    bug
    Customer Reported
    on Oct 26, 2024
  2. Matthiee commented on Oct 26, 2024

    @Matthiee
    Member

    Hi @carstencodes, thank you for reporting this bug.

    Is it possible to use something like ~ or any other character to indicate stin/stdout?

    The problem probably is that - is parsed as an option instead of value.

    I don't have a lot of time to look at this right now, but I'm happy to review PRs that fix this.

  3. carstencodes commented on Oct 26, 2024

    @carstencodes
    Author

    Hi,

    I try to be as unix compatible as possible in my application. And the convention here is to use the minus for these streams.

    I have read the code a bit and I think the issue is really weird, but bound to a faulty (or rather non-existent) state machine in the ArgumentManager class.

    This might take a bit, maybe I'll figure it out ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Customer Reportedbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions