Skip to content

feat: slash command for changing connection#27

Merged
tisonkun merged 8 commits into
scopedb:mainfrom
andylokandy:dev
Jun 3, 2026
Merged

feat: slash command for changing connection#27
tisonkun merged 8 commits into
scopedb:mainfrom
andylokandy:dev

Conversation

@andylokandy

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 ReplState to hold REPL runtime state (client, prompt, format, timer, connection name).
  • Add /connection NAME subcommand 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.

Comment thread scopeql/src/repl/entrypoint.rs Outdated
Comment thread scopeql/src/repl/command.rs Outdated
Comment thread scopeql/src/repl/entrypoint.rs
Comment thread scopeql/src/repl/entrypoint.rs Outdated
Comment thread scopeql/src/repl/command.rs Outdated
#[command(name = "/format")]
Format(CommandFormat),
/// Display or set the timing display mode.
/// Enable or disable timing display.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The original comment is correct, /timer print whether the timer is on or off.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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:

  1. Every time there is an input, the system switches states.
  2. A dropdown menu appears.
  3. Users can then select different REPL commands through that interface.

We can look into implementing that approach later on.

Comment thread scopeql/src/repl/command.rs Outdated
}

#[derive(Debug, Parser)]
#[command(disable_help_flag = true)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

help_flag for subcommands should be fine for now.

tisonkun added 2 commits June 3, 2026 15:47
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
@tisonkun tisonkun merged commit 77f999f into scopedb:main Jun 3, 2026
11 checks passed
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.

3 participants