(bind-func fleet_print_machines
(lambda (host:i8* port:i32)
(let ((machines (fleet_get_machines host port)))
(if (not (null? machines))
(begin
(println "Fleet machines:\n")
(doloop (i (json_array_size machines))
(let ((mchn (json_array_get machines i)))
(printf "[%lld] id: %s\n" i (json_string_value (json_object_get mchn "id")))
(printf " IP: %s\n" (json_string_value (json_object_get mchn "primaryIP")))
(println)))
(json_decref machines))
(println "Fleet: no machines found.")))))