add target option to command line, fix | when its last char on line

This commit is contained in:
2024-08-19 21:37:24 +03:00
parent 86dbe8eb0a
commit 4367febcd7
2 changed files with 24 additions and 11 deletions

View File

@@ -61,7 +61,13 @@
:filepath
:description "Kaynak dosyasını belirt."
:short-name #\k
:key :kaynak)))
:key :kaynak)
(clingon:make-option
:string
:initial-value "nasm"
:description "Derleme hedefini belirt."
:short-name #\h
:key :hedef)))
(defun subcommands ()
(list (clingon:make-command
@@ -69,10 +75,17 @@
:description "Dosyadaki programı derle"
:usage "<dosya-ismi>"
:options (comp-options)
:handler (lambda (cmd) (generate-program
(make-program
(clingon:getopt cmd :kaynak))
:compile t)))
:handler
(lambda (cmd) (let ((hedef (clingon:getopt cmd :hedef)))
(generate-program
(make-program
(clingon:getopt cmd :kaynak))
:path
(format nil "output.~a"
(cond ((string-equal "nasm" hedef) "asm")
((string-equal "c" hedef) "c")))
:compile t
:target (intern (string-upcase hedef) :keyword)))))
(clingon:make-command
:name "test"
:description "Testleri çalıştır."