$ git diff diff --git a/chicken-select.scm b/chicken-select.scm old mode 100644 new mode 100755 index 1b4beec..8b6b3d4 --- a/chicken-select.scm +++ b/chicken-select.scm @@ -1,6 +1,6 @@ #!/usr/bin/csi -s -(use srfi-1 posix stty) +(use srfi-1 posix) (include "chicken-env") (assert-chicken-coop-exists) @@ -57,16 +57,18 @@ all-chicks (iota (length all-chicks))) (newline) - (print "Select a new Chicken, press ENTER to abort:") - (let* ((choice-raw (with-stty '(cbreak (not echo)) read-char)) - (num (string->number (string choice-raw)))) - (if (and - num - (<= 0 num) - (< num (length all-chicks))) - (begin - (print "Setting current Chicken to " (list-ref all-chicks num)) - (set-current-chicken (list-ref all-chicks - num) - chicken-link)) - (select choice-raw))))))) \ No newline at end of file + (print* "Select a new Chicken, press ENTER to abort: ") + (let ((choice-raw (read-line))) + (if (equal? choice-raw "") + (exit) + (let ((num (string->number choice-raw))) + (if (and + num + (<= 0 num) + (< num (length all-chicks))) + (begin + (print "Setting current Chicken to " (list-ref all-chicks num)) + (set-current-chicken (list-ref all-chicks + num) + chicken-link)) + (select choice-raw)))))))))