Skip to content

Commit

Permalink
feat: Rename from qob to qob-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Oct 20, 2024
1 parent 305764a commit dd14fee
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 29 deletions.
8 changes: 4 additions & 4 deletions cmds/core/build.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

;;; Code

(defpackage qob/build
(defpackage qob-cli/build
(:use cl)
(:export command))

(in-package :qob/build)
(in-package :qob-cli/build)

(defun options ()
"Options for `build' command."
Expand All @@ -31,8 +31,8 @@

(defun handler (cmd)
"Handler for `build' command."
(format t "~A" clingon:command-arguments)
(qob:call-script "core/build"))
;;(format t "~A" clingon:command-arguments)
(qob-cli:call-script "core/build"))

(defun command ()
"The `build' command."
Expand Down
6 changes: 3 additions & 3 deletions cmds/core/dists.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

;;; Code

(defpackage qob/dists
(defpackage qob-cli/dists
(:use cl)
(:export command))

(in-package :qob/dists)
(in-package :qob-cli/dists)

(defun options ()
"Options for `dists' command."
Expand All @@ -20,7 +20,7 @@
(defun handler (cmd)
"Handler for `dists' command."
(declare (ignore cmd))
(qob:call-script "core/dists"))
(qob-cli:call-script "core/dists"))

(defun command ()
"The `dists' command."
Expand Down
6 changes: 3 additions & 3 deletions cmds/core/install.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

;;; Code

(defpackage qob/install
(defpackage qob-cli/install
(:use cl)
(:export command))

(in-package :qob/install)
(in-package :qob-cli/install)

(defun options ()
"Options for `install' command."
Expand All @@ -20,7 +20,7 @@
(defun handler (cmd)
"Handler for `install' command."
(declare (ignore cmd))
(qob:call-script "core/install"))
(qob-cli:call-script "core/install"))

(defun command ()
"The `install' command."
Expand Down
6 changes: 3 additions & 3 deletions cmds/core/list.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

;;; Code

(defpackage qob/list
(defpackage qob-cli/list
(:use cl)
(:export command))

(in-package :qob/list)
(in-package :qob-cli/list)

(defun options ()
"Options for `list' command."
Expand All @@ -20,7 +20,7 @@
(defun handler (cmd)
"Handler for `list' command."
(declare (ignore cmd))
(qob:call-script "core/list"))
(qob-cli:call-script "core/list"))

(defun command ()
"The `list' command."
Expand Down
10 changes: 5 additions & 5 deletions cmds/qob.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

;;; Code

(in-package :qob)
(in-package :qob-cli)

(defun options ()
"Options for `qob' command."
Expand All @@ -33,7 +33,7 @@
:license "MIT"
:options (options)
:handler #'handler
:sub-commands `(,(qob/build:command)
,(qob/dists:command)
,(qob/install:command)
,(qob/list:command))))
:sub-commands `(,(qob-cli/build:command)
,(qob-cli/dists:command)
,(qob-cli/install:command)
,(qob-cli/list:command))))
36 changes: 33 additions & 3 deletions lisp/_prepare.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
;;; Commentary: Prepare to setup Qob environment for sandboxing
;;; Code:


;;
;;; Includes

(require "asdf")

;;
;;; Environment

(defvar qob-dot-global (uiop:getenv "QOB_DOT_GLOBAL")
"Return the global .qob directory.")

Expand All @@ -13,6 +20,23 @@
(defvar qob-temp-filename (uiop:merge-pathnames* qob-dot-global "TMP")
"Return the temp buffer filename.")

(defun qob-dot ()
"Return the current .qob directory."
(if (qob-global-p) qob-dot-global qob-dot-local))

;;
;;; Flags

(defun qob-global-p ()
"Non-nil when in global space (`-g', `--global')."
;; TODO: ..
nil)

(defun qob-local-p ()
"Non-nil when in local space (default)."
;; TODO: ..
t)

;;
;;; Utils

Expand All @@ -34,10 +58,16 @@
;;
;;; Package

(defun qob-quicklisp-installed-p ()
"Return non-nil if Quicklisp is already installed."
(uiop:file-exists-p (concatenate 'string (qob-dot) "quicklisp.lisp")))

(defun qob-install-quicklisp ()
"Install Quicklisp."
;; TODO: ..
(quicklisp-quickstart:install))
"Install Quicklisp if not installed."
(alexandria:when-let ((ql (qob-quicklisp-installed-p)))
(load ql)
(quicklisp-quickstart:install)
(ql:add-to-init-file)))

;;
;;; Verbose
Expand Down
4 changes: 2 additions & 2 deletions qob.asd → qob-cli.asd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defsystem "qob"
(defsystem "qob-cli"
:version "0.1.0"
:author "Jen-Chieh Shen"
:license "MIT"
Expand All @@ -19,4 +19,4 @@
(:file "src/main"))
:build-operation "program-op"
:build-pathname "bin/qob"
:entry-point "qob:main")
:entry-point "qob-cli:main")
4 changes: 2 additions & 2 deletions scripts/build.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
;; asdf:*central-registry*)

(push '*default-pathname-defaults* asdf:*central-registry*)
(asdf:load-system "qob")
(asdf:load-system "qob-cli")
(asdf:load-system "copy-directory")

;;(ql:quickload "cl-autorepo")
Expand All @@ -35,4 +35,4 @@
(delete-file exec)))

;; Build executable
(asdf:operate :build-op "qob")
(asdf:operate :build-op "qob-cli")
2 changes: 1 addition & 1 deletion src/main.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

;;; Code

(in-package :qob)
(in-package :qob-cli)

(defun make-dot-folder ()
"Create the dot folder."
Expand Down
4 changes: 2 additions & 2 deletions src/packages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

;;; Code

(defpackage qob
(defpackage qob-cli
(:use cl)
(:export
;; src/utils.lsip
Expand All @@ -29,4 +29,4 @@
;; src/main.lsip
main))

(in-package :qob)
(in-package :qob-cli)
2 changes: 1 addition & 1 deletion src/utils.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

;;; Code

(in-package :qob)
(in-package :qob-cli)

(defun dot-global ()
"Return the global .qob directory."
Expand Down

0 comments on commit dd14fee

Please sign in to comment.