go-opt v2.2.0 now supports providing individual descriptions for
completion items by appending a newline character to the completion item
followed by its description.
Do that for patch sub commands. Here's what it looks like:
apply (Apply the selected message(s) to the current project.)
cd (Change aerc's working directory to the current project.)
drop (Drop a patch from the repository.)
find (Search for applied patches.)
init (Create a new project.)
list (List the current project with the tracked patch sets.)
ls (List the current project with the tracked patch sets.)
rebase (Rebase the patch data.)
switch (Switch context to the specified project.)
term (Open a shell or run a command in the current project's directory.)
unlink (Delete all patch tracking data for the specified project.)
:patch
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Antonin Godard <antonin@godard.cc>
Instead of duplicating commands.QuoteSpace almost everywhere, make it
the default value for the post processing function of FilterList.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Antonin Godard <antonin@godard.cc>
Instead of printing completion items for patch sub commands in a random
order (depending on whatever go hash table seed is used), sort the
completion items using standard ASCII order.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Antonin Godard <antonin@godard.cc>
Update the Command interface to include a Description() method.
Implement the method for all commands using short descriptions inspired
from the aerc(1) man page.
Return the description values along with command names so that they can
be displayed in completion choices.
Implements: https://todo.sr.ht/~rjarry/aerc/271
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bojan Gabric <bojan@bojangabric.com>
Tested-by: Jason Cox <me@jasoncarloscox.com>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Use go-opt v2 new completion API which returns items descriptions along
with their text values.
Display the descriptions after the items separated by two spaces. Wrap
the descriptions in parentheses to better indicate that they are not
part of the completion choices. Limit the description length to 80
characters to avoid display issues.
Add a new style object completion_description in stylesets. By default,
the object will be rendered with a dimmed terminal attribute. Update all
stylesets and documentation accordingly.
Implements: https://todo.sr.ht/~rjarry/aerc/271
Link: https://git.sr.ht/~rjarry/go-opt/commit/ebeb82538395a
Changelog-added: Command completion now displays descriptions next
to completion items.
Changelog-added: New `completion_description` style object in style
sets used for rendering completion item descriptions.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bojan Gabric <bojan@bojangabric.com>
Tested-by: Jason Cox <me@jasoncarloscox.com>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Register all commands with the same function and store them in the same
map.
Use bit flags to determine in which contexts each command should be
available.
Remove duplicate commands now that the same command can be exposed in
multiple contexts.
Refactor API to allow executing commands from other commands without
import cycles.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Tested-by: Johannes Thyssen Tishman <johannes@thyssentishman.com>
Create the sub-command structure for the :patch command. Make the :patch
command accessible from any context.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>