wl-clipboard icon indicating copy to clipboard operation
wl-clipboard copied to clipboard

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

Open aqxa1 opened this issue 2 years ago • 1 comments

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).

aqxa1 avatar Apr 21 '22 03:04 aqxa1

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.

YaLTeR avatar May 22 '22 13:05 YaLTeR

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.

GregDMeyer avatar Nov 03 '22 00:11 GregDMeyer