Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add commands for managing queries in namedqueries mode #1533

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

brenns10
Copy link

@brenns10 brenns10 commented Jul 2, 2020

I wanted to use namedqueries as my main startup mode. I hadn't used namedqueries before and wanted some easy management tools for them. So this adds the following commands:

  • query-rename NEWNAME
  • query-duplicate NEWNAME (newname defaults to oldname_copy, so this can be bound to other commands)
  • query-remove is a shortcut for removequery global command, which deletes the currently highlighted query (after a prompt)
  • query-refine opens a prompt where you can edit the savequery command for the currently highlighted command. This is useful because it allows you to edit both the query name, and the query itself. This is effectively both an "edit" command, as well as a "edit and save as" command.

This branch is only preliminary - I wanted to check if there were any general objections to the approaches, naming, etc. If not, then I'd like to add documentation and tests.

By the way, great project! I'm enjoying using it and hope to be contributing more.

Both classes' apply() methods call FlushCommand(), which needs to be
awaited in order to complete. This commit resolves the following errors
when using the savequery/removequery commands:

     RuntimeWarning: coroutine 'UI.apply_command' was never awaited
def afterwards(self):
self.ui.current_buffer.rebuild()

"""remove the selected namedquery"""
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy found an issue: String statement has no effect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants