--ignore-user NAME PACKAGE_OR_TEAM doesn't work
vanvugt opened this issue · comments
The command line help says you can use [--ignore-user [IGNORE_USER ...]]
, but I find it doesn't work. The option seems to require an equals sign like --ignore-user=vanvugt
in order to work, which is different to what the documentation says.
Hi,
but I find it doesn't work.
You gotta give me more than that ;) Can you provide exactly what command you were using? Did you try with other users? Does your user have a custom character in it? Are you doing a team search or package search?
The arguments are managed and documented via the argparse library. Specifically, --ignore-user
is set up here via:
parser.add_argument(
"--ignore-user",
default=[],
nargs="*",
help="""ignore bugs edited last by the listed person""",
)
nargs allow passing multiple options to a single option so I would expect the following to work:
--ignore-user powersj vanvugt
Note that, the usage of this array is checked against the last active user, not the user who filed the issue.
Thanks!
I think I misinterpreted the problem. No sleep. The issue is that the package or team is ignored in:
ubuntu-bug-triage --ignore-user vanvugt desktop-packages
but this works:
ubuntu-bug-triage --ignore-user=vanvugt desktop-packages
Aaaaah I see now, thank you for the example.
It appears the argparser is grabbing everything thinking both vanvugt
and desktop-packages
are both part of the ignore user array until you add the =
. I think the more correct syntax would be the following:
ubuntu-bug-triage desktop-packages --ignore-user vanvugt
That way the package or team is a positional and everything after is a flag of some sort. Would adding a help statement that this is a greedy flag that will take everything after it until the next flag help?
I don't think it's great design to force that unusual ordering when the help text says the ordering is the reverse of that and both parameters are not mutually exclusive, even if optional:
usage: ubuntu-bug-triage [-h] [--anon] [--csv] [--debug]
[--ignore-user [IGNORE_USER ...]] [--json] [--open]
[--include-project] [--start-time START_TIME]
[--status STATUS] [--urls]
[package_or_team] [days]
Looking at that help text again I can see it's an ambiguous grammar so 🤷♂️ ... it's your project and you can resolve the ambiguity how you see fit. Thanks for replying.
I have put up #23 which will make the
ignore-user
not greedy and require the user to specify it multiple times for each users. The ignore user flag was originally added by @seb128. If you are all face-to-face this week, might be good to ask if this will break him.
Thanks for the ping, the change makes sense to me, it is indeed more robust this way
Thanks for confirming!