Skip to content

fmt: clap causes information loss #6353

@BenWiederhake

Description

@BenWiederhake
$ cat << EOF > test.txt
> do
> not
> format
> these
> words
> =but
> =these
> =words
> =please
> EOF
$ ../gnu/src/fmt -p= test.txt 
do
not
format
these
words
=but these words please
$ cargo run -q fmt -p= test.txt 
do not format these words =but =these =words =please
$

Or in general: GNU parses -p=ANYTHING to be the prefix =ANYTHING, whereas clap parses the same argument as the different string ANYTHING. This cannot be easily recovered, and basically requires parsing the arguments from scratch again.

This also affects many other tools. I think it was already documented somewhere, but I couldn't find it.

I see this as yet another strong argument in favor of #4254.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions