[Pkg-zsh-devel] debbugs bug number completion += bug subjects

Axel Beckert abe at debian.org
Wed Aug 24 07:25:42 UTC 2016


Hi Daniel,

Daniel Shahaf wrote:
> zsh master has bug number completion:
> 
>     % bts tag 82<TAB>
>     > bug number
>      …0510   …0947   …0951

Interesting. According to Completion/Debian/Type/_debbugs_bugnumber it
uses the cache directories from the "bts" command to look for bug
numbers, so it will only complete bug numbers for bug reports you've
already viewed with the "bts show" command.

> I've patched that completion to show bug subjects:
> 
>     % bts close type<TAB>
>     > bug number
>     778512  - mr: "unknown repository type" if config file is a symlink - Debian 
>     796872  - vim: E676 saving a buftype=nofile buffer - Debian Bug report logs
>     814753  - scummvm-tools: FTBFS on non-Linux: #error No system type defined - 

Nice!

> I wonder what to do with this patch: on the one hand, I'm not sure the
> extraction of <title>s into $descs is robust enough to be accepted by
> upstream; on the other hand, the patch works, and I suspect I'm not the
> only one who would find it useful.

It won't help in my case as the only bts subcommand I use and which
downloads bug reports is "bts --mbox show".

> +local -a descs; descs=(
> +  ${(f)"$(<$^cachedirs/*html(N) grep -o '<title>.*</title>' | tr \> \< | cut -d \< -f3 | perl -MHTML::Entities -lnE 'say decode_entities s/^#(\d+) - /\1:/r')"}

So to support the mbox based caches, similar code, but parsing out the
first subject line out of each mbox should suffice.

Then again, don't do that effort for me, it's just a general thought based
on my usage of "bts":

* I use "bts --mbox show" (aliased to "btsmutt" :-) usually on my mail
  server, because that's from where I send mail. And I usually use
  that command because I want to reply to a bug report I'm not
  subscribed to (yet).

* I use "bts tag" and friends (all the commands which modify bug
  reports) usually on my workstation. There's usually no bts cache at
  all on my workstation.

> P.P.S. HTML::Entities is a dependency of libwww-perl which is
> a dependency of 'bts cache' — by which I mean, 'bts cache' will fail to
> run if libwww-perl is not installed.

Sounds sane.

		Regards, Axel
-- 
 ,''`.  |  Axel Beckert <abe at debian.org>, http://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-    |  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE



More information about the Pkg-zsh-devel mailing list