Skip to content

shtab tripped up by Waydroid argparse parser with subcommands. #185

@nt8r

Description

@nt8r

I'm using shtab 1.7.2.dev0+g61ec99d.d20241116 on Arch Linux, trying to generate tab completion for Waydroid. Waydroid installs to /usr/lib/waydroid without installing itself as a python module, so I first cd /usr/lib/waydroid. Then, running shtab tools.helpers.arguments generates a usage error from the Waydroid parser:

$ shtab tools.helpers.arguments       
usage: waydroid [-h] [-V] [-l LOG] [--details-to-stdout] [-v] [-q] [-w] {status,log,init,upgrade,session,container,app,prop,show-full-ui,first-launch,shell,logcat} ...
waydroid: error: argument action: invalid choice: 'tools.helpers.arguments' (choose from status, log, init, upgrade, session, container, app, prop, show-full-ui, first-launch, shell, logcat)

The "invalid choice" indicates that the module path is getting interpreted as a subcommand, so I figured this is what the --prog shtab option is for.

Trying shtab --prog=status tools.helpers.arguments produces the exact same output as before.

Trying shtab --prog status tools.helpers.arguments (space instead of equals) results in Waydroid's parser complaining:

waydroid: error: unrecognized arguments: --prog tools.helpers.arguments

At this point I gave up. I'm not sure what's going wrong here, but I figured it's worth reporting. For others trying to autocomplete Waydroid, it turns out that it does have argcomplete support, and that works.

Metadata

Metadata

Assignees

Labels

invalidDoesn't seem right

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions