Ticket #676 (closed enhancement: fixed)

Opened 11 years ago

Last modified 9 years ago

bash completion for cave

Reported by: filko_ Owned by: pioto
Priority: Sometime Milestone:
Component: completion/bash Version: 0.30.3
Keywords: Cc:
Blocked By: Blocking:
Distribution: N/A

Description


Attachments

cave Download (6.4 KB) - added by filko_ 11 years ago.

Change History

comment:1 follow-up: ↓ 2 Changed 11 years ago by pioto

  • Status changed from new to accepted

This is sort of how I was going to go about it... But a few suggestions/comments:

  • Use cave print-packages at least for cave show, when not completing options (or completing an argument for an option that takes an additional bit (like --repository)
  • Don't use paludis --list-* for any of this. We have cave print-* for this purpose -- it's generally faster than paludis --list-foo |sed ... If there's a cave print command that's missing, poke someone and it should probably be able to be added quickly

comment:2 in reply to: ↑ 1 Changed 11 years ago by filko_

Replying to pioto:

But a few suggestions/comments:

Yeah, indeed, thanks for them. It also looks that I missed ahf's miracle of multiplication of commands as well, so I'll look into that too.

Changed 11 years ago by filko_

  • attachment cave Download added

comment:3 follow-up: ↓ 4 Changed 11 years ago by filko_

That's an updated version, that includes all current commands plus object search for cave show. This one is extreamly slow on my old laptop so I was thinking of some form of caching *_lists or something.

comment:4 in reply to: ↑ 3 Changed 11 years ago by pioto

Replying to filko_:

That's an updated version, that includes all current commands plus object search for cave show. This one is extreamly slow on my old laptop so I was thinking of some form of caching *_lists or something.

I don't think that a number of those things ought to be cached in the shell. For one, the packages list is probably going to be pretty large. Also, it's subject to change between syncs, but this cache won't expire until you close your shell.

As far as the speed of print-packages... it's something I intend to look into. I have a few ideas of how to speed it up in some cases, but this would be done in the C++ code, not using the sort of hacks the paludis bash completion uses for this.

comment:5 Changed 10 years ago by pioto

Have you had a chance to look at this recently?

A bunch of new commands have been added to cave recently.

Also, to be more specific, don't do the _cave_command_list= sort of caching for anything. For commands, it's maybe okay. For things like packages, it will likely be inaccurate as of the next sync.

Also, as I think about it more, it might be better to focus on the 'cave porcelain' commands -- the things that are shown in the standard cave help output. The others, like print-*, are really "plumbing" commands. That's the same approach that the git completion seems to have taken.

I can/should probably add an option to cave print-commands to limit it to the porcelain commands.

comment:6 Changed 10 years ago by pioto

I started on this: aa759be, deb168c, a240663, 15ba5fd, 8c20a65

Also, I hate trac...

comment:7 Changed 9 years ago by ciaranm

  • Status changed from accepted to closed
  • Resolution set to fixed

We appear to have bash completion of some kind for cave now.

Note: See TracTickets for help on using tickets.