Skip to content

Commit 44fb420

Browse files
committed
feat: Add load command
1 parent 40be4c9 commit 44fb420

File tree

8 files changed

+67
-19
lines changed

8 files changed

+67
-19
lines changed

Qob

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@
1313
(depends-on "fsdb" "https://github.com/billstclair/fsdb" :git)
1414

1515
;; Test hooks
16-
(qob-add-hook 'qob-before-command-hook
17-
(lambda ()
18-
(qob-info "? before command")))
19-
20-
(qob-add-hook 'qob-after-command-hook
21-
(lambda ()
22-
(qob-info "? after command")))
23-
2416
(qob-add-hook 'qob-before-info-hook
2517
(lambda ()
2618
(qob-info "? before info")))

cmds/core/load.lisp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
;;;; cmds/core/load.lisp --- Load lisp files
2+
3+
;;; Commentary
4+
;;
5+
;; The `load' command definition.
6+
;;
7+
8+
;;; Code
9+
10+
(defpackage qob-cli/load
11+
(:use cl)
12+
(:export command))
13+
14+
(in-package :qob-cli/load)
15+
16+
(defun options ()
17+
"Options for `load' command."
18+
(list ))
19+
20+
(defun handler (cmd)
21+
"Handler for `load' command."
22+
(qob-cli:call-script "core/load" cmd))
23+
24+
(defun command ()
25+
"The `load' command."
26+
(clingon:make-command
27+
:name "load"
28+
:description "Load lisp files"
29+
:options (options)
30+
:handler #'handler))
31+
32+
;;; End of cmds/core/load.lisp

cmds/core/locate.lisp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;;;; cmds/core/locate.lisp --- Build executable
1+
;;;; cmds/core/locate.lisp --- Print the Qob installed location
22

33
;;; Commentary
44
;;

cmds/qob.lisp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
,(qob-cli/install-deps:command)
6868
,(qob-cli/install-dists:command)
6969
,(qob-cli/list:command)
70+
,(qob-cli/load:command)
7071
,(qob-cli/locate:command)
7172
,(qob-cli/status:command)
7273
,(qob-cli/uninstall:command))))

lisp/_prepare.lisp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@
6060
:error-output :interactive
6161
:force-shell t))
6262

63+
(defun qob-expand-file-specs (specs)
64+
"Expand file SPECS."
65+
(let ((temp-files))
66+
(mapcar (lambda (spec)
67+
(setq temp-files (append temp-files
68+
(directory spec))))
69+
specs)
70+
temp-files))
71+
6372
;;
6473
;;; Color
6574

@@ -158,7 +167,7 @@ The arguments FMT and ARGS are used to form the output message."
158167
Argument ENV-NAME is used to get the argument string."
159168
(let* ((args (uiop:getenv env-name))
160169
(args (concatenate 'string "'" args)))
161-
(qob-eval args)))
170+
(mapcar #'qob-2str (qob-eval args))))
162171

163172
(defvar qob-args (qob-parse-args "QOB_ARGS")
164173
"Positionl arguments (no options).")
@@ -296,7 +305,7 @@ the `qob-start' execution.")
296305
;;; Number (with arguments)
297306
(defun qob-verbose ()
298307
"Non-nil when flag has value (`-v', `--verbose')."
299-
(qob--flag-value "--verbose"))
308+
(parse-integer (qob--flag-value "--verbose")))
300309

301310
;;
302311
;;; Execution
@@ -510,12 +519,7 @@ to actually set up the systems."
510519
components)
511520
(directory "*.asd")
512521
(directory "*.lisp")
513-
(let ((temp-files))
514-
(mapcar (lambda (spec)
515-
(setq temp-files (append temp-files
516-
(directory spec))))
517-
qob-files)
518-
temp-files)))
522+
(qob-expand-file-specs qob-files)))
519523
files))
520524

521525
;;

lisp/core/list.lisp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
;;;; lisp/core/list.lisp --- Build executable
1+
;;;; lisp/core/list.lisp --- List the registered systems
22

33
;;; Commentary
44
;;
5-
;; Command use to list the registered system
5+
;; Command use to list the registered systems
66
;;
77
;; $ qob list
88
;;

lisp/core/load.lisp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
;;;; lisp/core/load.lisp --- Load lisp files
2+
3+
;;; Commentary
4+
;;
5+
;; Command use to load lisp files
6+
;;
7+
;; $ qob load [files..]
8+
;;
9+
10+
;;; Code
11+
12+
(qob-start
13+
(let ((files (qob-expand-file-specs (qob-args))))
14+
(if files
15+
(mapc #'load files)
16+
(eask-info "(Nothing to load.)"))))
17+
18+
;;; End of lisp/core/load.lisp

qob-cli.asd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
(:file "cmds/core/install-deps")
2626
(:file "cmds/core/install-dists")
2727
(:file "cmds/core/list")
28+
(:file "cmds/core/load")
2829
(:file "cmds/core/locate")
2930
(:file "cmds/core/status")
3031
(:file "cmds/core/uninstall")

0 commit comments

Comments
 (0)