Skip to content

Add \ne to edit a named query in the external editor#1609

Open
DiegoDAF wants to merge 1 commit into
dbcli:mainfrom
DiegoDAF:feature/ne-edit-named-query
Open

Add \ne to edit a named query in the external editor#1609
DiegoDAF wants to merge 1 commit into
dbcli:mainfrom
DiegoDAF:feature/ne-edit-named-query

Conversation

@DiegoDAF

Copy link
Copy Markdown
Contributor

Summary

Adds \ne <name>, a special command to edit a named query in the external editor ($EDITOR).

It loads the named query's SQL into the editor and, on save, writes the edited result back to the [named queries] section of the config (creating the entry if it does not exist). This complements \ns (save) by making it practical to edit longer named queries without retyping them, mirroring how \e / \ev / \ef already open the editor.

Addresses the editor part of #1430.

Behavior

  • \ne foo on an existing query: opens it in $EDITOR; saving updates it.
  • \ne foo on a new name: opens an empty editor; saving creates it.
  • Empty result or no changes: nothing is saved (reported in the status).

Tests

  • tests/test_main.py::test_edit_named_query covers create / update / no-change / empty / editor-error / usage (editor mocked, no DB needed).

Changelog

  • Added an entry under a new Upcoming section.

\ne <name> loads a named query's SQL into $EDITOR and writes the edited
result back to the [named queries] section on save, creating it if it does
not exist. Complements \ns for editing longer queries. Addresses the
editor part of issue dbcli#1430.
@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@DiegoDAF

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 117449b1a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

1 participant