bugaevc / wl-clipboard

Command-line copy/paste utilities for Wayland
GNU General Public License v3.0
1.62k stars 60 forks source link

Text that includes a leading "-" is interpreted as an option by wl-copy #131

Closed aqxa1 closed 1 year ago

aqxa1 commented 2 years ago

In some cases I have text I want to copy that includes a leading "-", which wl-copy interprets as an option, and consequently breaks. Thankfully, the program uses getopt so the text can be added after specifying --, which tells it not to interpret it as an option. Probably just documenting it would be enough, or maybe it could be made a non-positional argument (and so the text isn't interpreted by getopt).

YaLTeR commented 2 years ago

Yeah, that's how getopt works, it's intentional in wl-clipboard. It would be good to mention it in the man page, e.g. add [--] before the arguments in the command example.

GregDMeyer commented 2 years ago

If it's possible for your use case, just FYI another way to get around this issue is by passing the text via stdin instead of on the command line.