-
Notifications
You must be signed in to change notification settings - Fork 25
LISP on Python
Nicolas Couture edited this page Apr 19, 2026
·
1 revision
MockSSH includes a Domain Specific Language (DSL) built on Hy (a LISP dialect that compiles to Python bytecode). This allows you to define mock servers in a declarative style that resembles a configuration file rather than a script.
Because Hy is fully integrated with Python, the DSL has direct access to the entire MockSSH library while providing a cleaner syntax for nested command definitions.
The top-level macro used to launch a server.
(mock-ssh :users {"admin" "1234"}
:host "127.0.0.1"
:port 2222
:prompt "hostname>"
:commands [...])Defines a standard ArgumentValidatingCommand.
(command :name "wr"
:type "write"
:on-success ["write" "[OK]"]
:on-failure ["write" "Usage: wr m"])Defines a PromptingCommand flow.
(prompting-command :name "enable"
:output "Password: "
:required-input "secret"
:on-success ["prompt" "admin#"]
:on-failure ["write" "Denied."])