Skip to content

Commit

Permalink
Add header to console
Browse files Browse the repository at this point in the history
When the console is launched, it now prints this message:

    conduwuit VERSION admin console
    "help" for help, ^D to exit the console, ^\ to stop the server
  • Loading branch information
nsvedberg authored and girlbossceo committed Jan 9, 2025
1 parent 8c74e35 commit 7526ba9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/service/admin/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ impl Console {

pub async fn close(self: &Arc<Self>) {
self.interrupt();

let Some(worker_join) = self.worker_join.lock().expect("locked").take() else {
return;
};
Expand Down Expand Up @@ -92,6 +93,12 @@ impl Console {
#[tracing::instrument(skip_all, name = "console", level = "trace")]
async fn worker(self: Arc<Self>) {
debug!("session starting");

self.output
.print_inline(&format!("**conduwuit {}** admin console\n", conduwuit::version()));
self.output
.print_text("\"help\" for help, ^D to exit the console, ^\\ to stop the server\n");

while self.server.running() {
match self.readline().await {
| Ok(event) => match event {
Expand Down Expand Up @@ -147,6 +154,7 @@ impl Console {

self.add_history(line.clone());
let future = self.clone().process(line);

let (abort, abort_reg) = AbortHandle::new_pair();
let future = Abortable::new(future, abort_reg);
_ = self.command_abort.lock().expect("locked").insert(abort);
Expand Down

0 comments on commit 7526ba9

Please sign in to comment.