X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?p=clnl;a=blobdiff_plain;f=src%2Fmain%2Fextensions%2Fcli%2Fcli.lisp;h=717d79cc1767135a90f13604e4f1d3504057ea9c;hp=84533918e1e49c6156f501a7f050d9348f927a2d;hb=89cb3482de1fefc2d8e5f67e1e04a0790e8cd243;hpb=057ed8dbc95f13245afd62e4f4769fc29f42b0c8 diff --git a/src/main/extensions/cli/cli.lisp b/src/main/extensions/cli/cli.lisp index 8453391..717d79c 100644 --- a/src/main/extensions/cli/cli.lisp +++ b/src/main/extensions/cli/cli.lisp @@ -1,18 +1,28 @@ (in-package #:clnl-extension-cli) -(defun prims () - "PRIMS => PRIMS - -ARGUMENTS AND VALUES: - - PRIMS: Primitives defined for this extension - -DESCRIPTION: - - PRIMS returns the primitives used in the CLI extension." +(defmethod clnl-extensions:prims ((extension (eql :cli))) (list - (list :name :q :type :command :func #'shut-down))) + (list :name :q :type :command :func #'shut-down) + (list :name :load :type :command :args '(t) :func #'load-file) + (list :name :help :type :command :args '((:token :optional)) :precedence 20 :func #'help) + (list + :name :button :type :command :args '(:string (:number :optional)) + :precedence 20 :func #'clnl-model:execute-button))) (defun shut-down () - (cl-charms/low-level:endwin) (sb-ext:exit :abort t)) + +(defun load-file (file) + (clnl:boot file)) + +(defun help (&optional token) + (format t + (if (not token) + "Placeholder help facility, try <:help :q> or <:help :load> for information about the commands we accept" + (case token + (:|:Q| ":q quits out of clnl") + (:|:LOAD| + (concatenate 'string + ":load loads up a model into the current clnl instance." + " Try :load \"Wolf Sheep Predation.nlogo\"")) + (t (format nil "Don't have help for ~S" token))))))