python3-argcomplete does seem quite useful for complex pythonic autocompletion, but it seems to have downside as well - users will need to run a script to set it up first: https://pypi.org/project/argcomplete/#activating-global-completion
am I misunderstanding that? Seems like a fairly big ask for users to have to know to 'set up' their global argcomplete before it works at all. Maybe the debian/ubuntu python[3]-argcomplete pkg should invoke the global activation script on deb install? plus, for this use case, it really does seem like just a good-old bash completion function is easier, at least to start with. First, I think the "best" way to generate the list of autocomplete pkgs would be to get the current list of all source and binary package names from lp. However, that's basically a non-starter as it would take way, way too long for autocomplete purposes. Caching it all would be good, but (assuming we don't want to create a background cache update just for this) it would prevent autocomplete until the cache was up to date. As a compromise, I think using apt's package cache will be "good enough", at least to start with. It's actually rather trivial to do that; for quick testing: $ _pullpkg() { local cur; _init_completion || return; COMPREPLY=($( apt-cache --no-generate pkgnames "$cur" 2> /dev/null )); return 0; } $ complete -F _pullpkg pull-lp-source After that, in the bash shell where you ran those cmds, pull-lp-source should autocomplete any/all package names. Those 2 lines can be dropped into ~/.bash_completion (or a file in /usr/share/bash- completion/completions/ or /etc/bash_completions.d/) and all new shells will pick up the autocompletion. Unfortunately that still isn't quite perfect; for example there are lots and lots (and lots and LOTS) of different kernel package names. If I'm running bionic but I want to pull a specific kernel from trusty, the apt autocompletion won't provide those package names (because each kernel package has version-specific naming). It might be worth trying to use the apt cache for the first 3 (or so) letters of a package name, but after that switch to real LP querying (hopefully with caching). Or, maybe we could use a LP package local cache, but if that's not populated yet fall back to apt caching. ** Changed in: ubuntu-dev-tools (Ubuntu) Assignee: (unassigned) => Dan Streetman (ddstreet) ** Changed in: ubuntu-dev-tools (Ubuntu) Importance: Undecided => Low -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1797290 Title: no bash-completion for pull-lp-source (and probably others) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/ubuntu-dev-tools/+bug/1797290/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs