Skip to content

Commit

Permalink
stomp.cli: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed May 9, 2024
1 parent e8f9e3d commit 9dbe68f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions extra/stomp/cli/cli.factor
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,13 @@ CONSTANT: COMMANDS {
! XXX: when disconnected, exit with a message
! XXX: print incoming and outgoing messages nicely

TUPLE: stomp-command-loop < command-loop ;

M: stomp-command-loop run-command-loop
: start-stomp-client ( -- )
[
stomp-host get resolve-host [ ipv4? ] filter random
stomp-port get with-port utf8 [
stomp-mailbox [ [ nl . flush ] with-global ] stomp-loop
] with-client
] in-thread call-next-method ;
] in-thread ;

: stomp-options ( args -- )
[
Expand All @@ -89,10 +87,9 @@ M: stomp-command-loop run-command-loop

: stomp-main ( -- )
command-line get stomp-options
"Welcome to STOMP!" "STOMP>"
stomp-command-loop new-command-loop
"Welcome to STOMP!" "STOMP>" <command-loop>
COMMANDS [ over add-command ] each
run-command-loop ;
start-stomp-client run-command-loop ;

MAIN: stomp-main

0 comments on commit 9dbe68f

Please sign in to comment.