|
10 | 10 | (defvar *syntax-scan-window-recursive-p* nil) |
11 | 11 | (defvar *help* "Usage: lem [ OPTION-OR-FILENAME ] ... |
12 | 12 | Options: |
13 | | - -q, --no-init-file do not load ~/.lem/init.lisp |
14 | | - --slime PORT start slime on PORT |
15 | | - --eval EXPR evaluate lisp expression EXPR |
16 | | - --debug enable debugger |
17 | | - --log-filename FILENAME file name of the log file |
18 | | - --kill immediately exit |
19 | | - -v, --version print the version number and exit |
20 | | - -h, --help display this help and exit" |
| 13 | + -q, --no-init-file do not load ~/.lem/init.lisp |
| 14 | + --slime PORT start slime on PORT |
| 15 | + --eval EXPR evaluate lisp expression EXPR |
| 16 | + --debug enable debugger |
| 17 | + --log-filename FILENAME file name of the log file |
| 18 | + --kill immediately exit |
| 19 | + --gui to use any available GUI interface |
| 20 | + --nogui to use any available terminal interface |
| 21 | + --ncurses to use ncurses terminal interface |
| 22 | + --sdl2 to use SDL2 GUI interface |
| 23 | + --sdl to use any available SDL GUI interface |
| 24 | + -i, --interface INTERFACE interface to use, either sdl2 or ncurses |
| 25 | + -v, --version print the version number and exit |
| 26 | + -h, --help display this help and exit" |
21 | 27 | "Help output for cli") |
22 | 28 |
|
23 | 29 | (defun syntax-scan-window (window) |
@@ -89,7 +95,8 @@ Options: |
89 | 95 | args |
90 | 96 | (debug nil) |
91 | 97 | (log-filename nil) |
92 | | - (no-init-file nil)) |
| 98 | + (no-init-file nil) |
| 99 | + (interface nil)) |
93 | 100 |
|
94 | 101 | (defun parse-args (args) |
95 | 102 | (let ((parsed-args |
@@ -122,6 +129,23 @@ Options: |
122 | 129 | (error "Please, specify a filename to log to.")) |
123 | 130 | (setf (command-line-arguments-log-filename parsed-args) |
124 | 131 | filename))) |
| 132 | + ((equal arg "--ncurses") |
| 133 | + (setf (command-line-arguments-interface parsed-args) :ncurses)) |
| 134 | + ((equal arg "--sdl2") |
| 135 | + (setf (command-line-arguments-interface parsed-args) :sdl2)) |
| 136 | + ((equal arg "--sdl") |
| 137 | + (setf (command-line-arguments-interface parsed-args) :sdl2)) |
| 138 | + ((equal arg "--gui") |
| 139 | + (setf (command-line-arguments-interface parsed-args) :sdl2)) |
| 140 | + ((equal arg "--nogui") |
| 141 | + (setf (command-line-arguments-interface parsed-args) :ncurses)) |
| 142 | + ((member arg '("-i" "--interface") :test #'equal) |
| 143 | + (let ((interface (pop args))) |
| 144 | + (if (and interface (plusp (length interface))) |
| 145 | + (setf (command-line-arguments-interface parsed-args) |
| 146 | + (alexandria:make-keyword (string-upcase interface))) |
| 147 | + (write-line "Please specify an interface to use." |
| 148 | + *error-output*)))) |
125 | 149 | ((equal arg "--kill") |
126 | 150 | `(uiop:quit)) |
127 | 151 | ((member arg '("-v" "--version") :test #'equal) |
@@ -258,7 +282,14 @@ See scripts/build-ncurses.lisp or scripts/build-sdl2.lisp" |
258 | 282 | (cond (*in-the-editor* |
259 | 283 | (apply-args args)) |
260 | 284 | (t |
261 | | - (let ((implementation (get-default-implementation :errorp nil))) |
| 285 | + (let ((implementation |
| 286 | + (get-default-implementation |
| 287 | + :errorp nil |
| 288 | + :implementation |
| 289 | + (or (command-line-arguments-interface args) |
| 290 | + (if (interactive-stream-p *standard-input*) |
| 291 | + :ncurses |
| 292 | + :sdl2))))) |
262 | 293 | (unless implementation |
263 | 294 | (maybe-load-systems :lem-ncurses) |
264 | 295 | (setf implementation (get-default-implementation))) |
|
0 commit comments