Skip to content

Commit

Permalink
add alias for lisp script impl
Browse files Browse the repository at this point in the history
  • Loading branch information
snmsts committed Jan 30, 2024
1 parent eac8e53 commit 895fc2d
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions lib/script/impl/main.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,29 @@

(defun sub-commands ())

(defun options ())
(defun options ()
(list
(clingon:make-option
:string
:description "designate script name"
:parameter "ALIAS"
:short-name #\A
:long-name "alias"
:key :alias)))

(defun handler (cmd)
(let* ((args (clingon:command-arguments cmd))
(impl (first args))
(to (ensure-directories-exist
(make-pathname
:defaults (bin-dir)
:name impl
:name (or (clingon:getopt cmd :alias) impl)
:type nil))))
(message :script-impl "script impl ~S" args)
(unless (clingon:command-arguments cmd)
(clingon:run cmd '("--help")))
(with-open-file (o to :direction :output :if-exists :supersede)
(format o "~{~A~%~}"
`("#!/bin/sh"
"#|-*- mode:lisp -*-|#"
"#|"
,(format nil "exec lisp run -L ~A --native -- \"$@\"" impl)
"|#")))))
,(format nil "exec lisp run -L ~A --native -- \"$@\"" impl))))
(sb-posix:chmod to #o755)))

0 comments on commit 895fc2d

Please sign in to comment.