23 Commits

Author SHA1 Message Date
Robin Jarry
d0484b153a completion: add command option descriptions
Add `desc:""` struct field tags in all command arguments where it makes
sense.

The description values will be returned along with 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>
2024-10-23 10:22:51 +02:00
Robin Jarry
26033eaecf completion: add commands descriptions
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>
2024-10-23 10:22:51 +02:00
Robin Jarry
3c9ad93801 completion: display descriptions next to choices
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>
2024-10-23 10:22:51 +02:00
Johannes Thyssen Tishman
3d529aa093 config: make popover dialogs configurable
Add the [ui].dialog-{position,width,height} options in aerc.conf to set
the position, width and height of popover dialogs such as the one from
:menu, :envelope or :attach -m relative to the main window.

Changelog-added: Add `[ui].dialog-{position,width,height}` to set
 the position, width and height of popover dialogs.
Signed-off-by: Johannes Thyssen Tishman <johannes@thyssentishman.com>
Reviewed-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2024-04-02 22:22:33 +02:00
Robin Jarry
2453375721 commands: rename confusing constants
There is an overlap between ACCOUNT and MESSAGE. Rename ACCOUNT to
MESSAGE_LIST and use MESSAGE_LIST|MESSAGE_VIEWER instead of MESSAGE.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Tim Culverhouse <tim@timculverhouse.com>
2024-03-04 22:30:14 +01:00
Robin Jarry
8edf7b0e4d log: move package to lib
This has nothing to do at the root of the source tree.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
2024-02-14 23:04:38 +01:00
Tim Culverhouse
63b9706441 aerc: change event interfaces to vaxis events
Modify the function signature of Event and MouseEvent interfaces to
accept vaxis events. Note that because a vaxis event is an empty
interface, the implementations are not affected and the events are
delivered as they were before

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2024-02-12 13:48:42 +01:00
Koni Marti
4cc2e6be3a commands: rename patch delete to patch unlink
Rename the command :patch delete to :patch unlink. This expresses the
"link" between the project data within aerc and the underlying
repository better. :patch unlink does not delete anything in the
repository, it only removes the metadata about currently applied patch
revisions/tags.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2024-01-31 21:57:28 +01:00
Koni Marti
b285b894c3 commands: rename patch remove to patch drop
Rename the :patch remove command to :patch drop to better express the
this operation is the counter-part to :patch apply.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2024-01-31 16:54:31 +01:00
Koni Marti
5719041eb9 app: define two dialog constructors
Define two new constructor functions for the popup dialog.
DefaultDialog() creates a dialog that spans half of the screen, whereas
the LargeDialog() covers three-quarter of the screen.

If a dialog widget has more specific size requirements, custom window
position and window height functions can be used with NewDialog().

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2024-01-29 22:46:08 +01:00
Robin Jarry
159fb38daf commands: refactor registration
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>
2024-01-20 21:56:25 +01:00
Koni Marti
6f8f3d718c patch/find: add find sub-cmd
Implement the :patch find command. Search and filter for a given commit
by subject line in the current accout and current folder.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2023-12-30 15:42:09 +01:00
Koni Marti
f8c9e7fff5 patch: implement worktree support
Implement worktree support for the patch management.

Use ":patch apply -w <commit-ish> <tag>" to create a new worktree and
apply the selected messages to it. The worktree is linked to repo in the
current project.

Internally, the worktree is stored as a new project. When this project
is deleted with ":patch delete", the underlying linked worktree is
removed as well.

":patch list" shows when a project is a worktree and to what project it
is linked to.

Worktrees enable the users to create a new copy of the repo at a given
commit and apply patches without interrupting the current work in the
base repo.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2023-12-30 15:42:09 +01:00
Koni Marti
cfcab6c5c8 patch/switch: add switch sub-cmd
Implement the :project switch command. Switch between different
projects.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2023-12-30 15:42:09 +01:00
Koni Marti
8671d9dc48 patch/delete: add delete sub-cmd
Implement the :patch delete command. Remove the project data from the
permanent store. If no argument is provided, the current project will be
deleted.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2023-12-30 15:42:09 +01:00
Koni Marti
d49ed00df0 patch/term: add term sub-cmd
Implement the :patch term command. This will open a shell in the
project's root directory that was defined during the :project init
setup.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2023-12-30 15:42:09 +01:00
Koni Marti
6592d6e711 patch/rebase: add rebase sub-cmd
Implement the :patch rebase command. Rebase the internal patch data in
case the repository was rebased too. The :patch rebase command accepts a
optional argument which is used as the reference commit from which the
rebasing will occur.

Open an editor with the commits that are found on top of the rebase
reference. Any untracked commit will have the tag 'untracked'. If a line
is removed or the 'untracked' tag remains, it will be dropped from the
internal data.

To group commits into a patch set, assign the same tag names.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2023-12-30 15:42:09 +01:00
Koni Marti
c711fe1cab patch/cd: add cd sub-cmd
Implement the :patch cd command. Change the directory to the project's
root directory that was determined during the :patch init setup process.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2023-12-30 15:42:09 +01:00
Koni Marti
41e066768c patch/remove: add remove sub-cmd
Implement the :patch remove command. Remove a patch set from the
respository and from the internal storage. Note that in git, this will
change all commit hashes that appear after the removed one since the
commit hash depends on its parents. Adjust the code to handle such cases
and add tests for this.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2023-12-30 15:42:09 +01:00
Koni Marti
cf47763e55 patch/list: add list sub-cmd
Implement the :patch list command. List the the current project and add
a flag to list all saved projects. Use the pager to display the data and
extract the pager commands and move them into the config package.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2023-12-30 15:42:09 +01:00
Koni Marti
fdd9f7991a patch/apply: add apply sub-cmd
Add the :patch apply command to apply a patch set and create a
corresponding tag. The tag command argument can be completed based on
the subject lines of the selected messages. Add a test for the
completion proposal.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2023-12-30 15:42:09 +01:00
Koni Marti
f98382d1df patch/init: add init sub-cmd
Implement the :patch init command to initialize a new project.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2023-12-30 15:42:09 +01:00
Koni Marti
07c1cefcf6 patch: create sub-command structure
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>
2023-12-30 15:42:09 +01:00