;; This is the main command "rulp", it includes the
;; global options and the subcommands
(defun rulp/handler (cmd)
- (clingon:print-usage-and-exit cmd t))
+ "handling the view"
+ (let ((mapfile (clingon:getopt cmd :rulp/map))
+ (initfile (clingon:getopt cmd :rulp/initfile))
+ (softwarep (clingon:getopt cmd :rulp/softwarep))
+ (name (format nil "Ru*** roLeplay Playground v~A" parameters:+rulp-version+)))
+ (test-correctness-required mapfile "json")
+ (test-correctness-optional initfile "lisp")
+ (format t "rulp-~A on ~A-~A~%"
+ parameters:+rulp-version+
+ parameters:+rulp-system+
+ parameters:+rulp-type+)
+ (if initfile (load initfile) (load "init.lisp" :if-does-not-exist nil))
+ (setf graphics:+plane+ (create-plane-from-json mapfile))
+ (graphics:playground name)))
(defun rulp/command ()
(clingon:make-command
:version "0.0.1"
:description "Roleplay playground"
:authors '("Giulio 'Zull' De Stasio <giuliodestasio98@gmail.com>")
- :usage "[-i INITFILE] COMMAND"
+ :usage "[-i INITFILE] -m MAP | COMMAND"
:license "GPLv3"
:handler #'rulp/handler
:options (rulp/options)
+ :examples '(("rulp -m map.json") ("rulp editor -m map.json"))
:sub-commands (rulp/sub-commands)))
(defun rulp/options ()
:short-name #\i
:long-name "init"
:key :rulp/initfile)
- ))
-
-(defun rulp/sub-commands ()
- "list of the subcommands of rulp"
- (list
- (view/command)
- (editor/command)))
-
-;; VIEW command
-;; this section is for the view/playground. The standard
-;; mode of use. This command include the basic functions like include
-;; a map and informations about software/hardware rendering
-(defun view/options ()
- "options for the view command"
- (list
(clingon:make-option :string
:description "Select the map to load (in JSON format)"
:short-name #\m
:required t
:long-name "map"
- :key :view/map)
+ :key :rulp/map)
(clingon:make-option :counter
:description "select software rendering (not working)"
:long-name "software"
- :key :view/software)
+ :key :rulp/softwarep)
))
-(defun view/command ()
- "create the view command"
- (clingon:make-command
- :name "view"
- :usage "[-s] -m <MAP> ..."
- :description "start the rulp map visualization"
- :options (view/options)
- :handler #'view/handler
- :examples '(("rulp view -m base.json") ("rulp view -m base.json -i newinit.lisp")))
- )
+(defun rulp/sub-commands ()
+ "list of the subcommands of rulp"
+ (list
+ (editor/command)))
-(defun view/handler (cmd)
- "handling the view"
- (let ((mapfile (clingon:getopt cmd :view/map))
- (initfile (clingon:getopt cmd :rulp/initfile))
- (software (clingon:getopt cmd :view/software))
- (name (format nil "Ru*** roLeplay Playground v~A" parameters:+rulp-version+)))
- (test-correctness-required mapfile "json")
- (test-correctness-optional initfile "lisp")
- (format t "rulp-~A on ~A-~A~%"
- parameters:+rulp-version+
- parameters:+rulp-system+
- parameters:+rulp-type+)
- (if initfile (load initfile) (load "init.lisp" :if-does-not-exist nil))
- (setf graphics:+plane+ (create-plane-from-json mapfile))
- (graphics:playground name)))
;; EDITOR command
;; this section modify the view to create a functional
:examples '("rulp editor -m base.png")))
(defun editor/handler (cmd)
- (let ((selected-map (clingon:getopt cmd :editor/map))
- (selected-init (clingon:getopt cmd :rulp/initfile)))
- (format t "test ~A and ~A~%" selected-map selected-init)))
+ (let ((mapfile (clingon:getopt cmd :editor/map))
+ (initfile (clingon:getopt cmd :rulp/initfile))
+ (softwarep (clingon:getopt cmd :rulp/softwarep)))
+ (format t "test ~A and ~A~%" mapfile initfile)))
(defun main ()
(let ((rulp-sys (rulp/command)))
(setf graphics:+plane+ (create-plane-from-json mapfile))
(graphics:playground (format nil "RULP start-pipe"))
)
+
+
+(defun repl-pipe (mapfile &optional initfile)
+ (test-correctness-required mapfile "json")
+ (test-correctness-optional initfile "lisp")
+ (format t "rulp-~A on ~A-~A~%"
+ parameters:+rulp-version+
+ parameters:+rulp-system+
+ parameters:+rulp-type+)
+ (if initfile (load initfile) (load "init.lisp" :if-does-not-exist nil))
+ (setf graphics:+plane+ (create-plane-from-json mapfile))
+ (graphics:playground (format nil "RULP start-pipe"))
+ )