feat: slash command for changing connection#27
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds the ability to switch REPL connection profiles via a new slash command, and refactors REPL runtime state to make the active connection and prompt mutable during a session.
Changes:
- Introduce
ReplStateto hold REPL runtime state (client, prompt, format, timer, connection name). - Add
/connection NAMEsubcommand to switch the active connection profile and update the prompt. - Add a reedline Ctrl-C/Ctrl-D workaround to decide whether to clear the line or exit based on buffer contents.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| scopeql/src/repl/prompt.rs | Adds an accessor for the prompt’s current endpoint so it can be shown after switching. |
| scopeql/src/repl/entrypoint.rs | Refactors REPL to use ReplState, adds connection switching, and updates Ctrl-C/Ctrl-D behavior via host commands. |
| scopeql/src/repl/command.rs | Adds /connection subcommand and adjusts subcommand ordering/help definitions. |
| scopeql/src/config.rs | Renames connection type and adds helpers for default connection name and enumerating profiles. |
| scopeql/src/client/mod.rs | Updates client construction to accept the renamed connection config type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #[command(name = "/format")] | ||
| Format(CommandFormat), | ||
| /// Display or set the timing display mode. | ||
| /// Enable or disable timing display. |
There was a problem hiding this comment.
The original comment is correct, /timer print whether the timer is on or off.
There was a problem hiding this comment.
I understand now that there is a status bar here to display this. However, since the functionality hasn't actually changed, I think we should leave it for a later task. If we decide to break it or delete that feature in the future, we can update this area accordingly.
We previously discussed that the REPL should move toward a selection-based model rather than this REPL path approach. The idea was:
- Every time there is an input, the system switches states.
- A dropdown menu appears.
- Users can then select different REPL commands through that interface.
We can look into implementing that approach later on.
| } | ||
|
|
||
| #[derive(Debug, Parser)] | ||
| #[command(disable_help_flag = true)] |
There was a problem hiding this comment.
help_flag for subcommands should be fine for now.
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
No description provided.