Closed ghost closed 6 years ago
Thanks for filling this issue. Yes, seems a really old bug of argparse. Some funny answers of people wanting optparser get be un-deprecated.
For now, I don't know any workaround. Maybe would be possible escape the argument as /-Bass
and remove /
internally since this character is not possible inside of username because conflicts with HTTP URL. But this solution is a quite awful... and I think that there is no hope for argparse since is a bug of almost 8 years.
I need think a little about it.
Actually, there is a workaround:
mal list --user=-Bass
Just tested it and it works, thanks man.
Since this is a problem with argparse and not correlated with mal, I'm closing this. I hope you enjoy the software, @sothym
Strange. Why doesn't mal list --user -- -Bass
work? The --
is meant to tell the arg parser that every arg from here on out is to be interpreted literally. I.e. ignore -
. I always implement this in my user interfaces. And it also exists in the coreutils:
cd -- -some-dir # cd to ./-some-dir/
rm -- -r # remove the file named "-r"
ls -l -- -l # lists -l if it exists, in long form
I would absolutely expect an arg parsing library to implement this, so it's strange that it doesn't.
Either way, good workaround.
Yes, this is a common thing on gnu stuff, but until I now argparse is not correlated to gnu software.
mal
is currently unable to search usernames that start with a dash,mal list --user "-Bass"
returns the following errorAfter browsing it seems like this is an upstream bug in python, https://bugs.python.org/issue9334
Is there any workaround to this?