-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright (C) 2022 Jen-Chieh Shen | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3, or (at your option) | ||
* any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with GNU Emacs; see the file COPYING. If not, write to the | ||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
* Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
"use strict"; | ||
|
||
const util = require("../src/util"); | ||
|
||
exports.command = 'exec [args..]'; | ||
exports.desc = 'execute command with correct load-path set up'; | ||
exports.builder = { | ||
args: { | ||
description: 'execution arguments', | ||
requiresArg: false, | ||
type: 'array', | ||
}, | ||
}; | ||
|
||
exports.handler = async ({ args }) => { | ||
await util.e_call('exec', args); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
;;; exec.el --- Execute command with correct load-path set up -*- lexical-binding: t; -*- | ||
|
||
;;; Commentary: | ||
;; | ||
;; Execute command with correct load-path set up | ||
;; | ||
;; $ eask exec [args..] | ||
;; | ||
;; | ||
;; Initialization options: | ||
;; | ||
;; [args..] execute command with correct load-path set up | ||
;; | ||
|
||
;;; Code: | ||
|
||
(load-file (expand-file-name | ||
"_prepare.el" | ||
(file-name-directory (nth 1 (member "-scriptload" command-line-args))))) | ||
|
||
(defun eask--add-bin-exec-path () | ||
"Add all bin directory to `exec-path'." | ||
(dolist (filename (directory-files-recursively package-user-dir "^\\([^.]\\|\\.[^.]\\|\\.\\..\\)")) | ||
(when (string-suffix-p "bin/" (file-name-directory filename)) | ||
(add-to-list 'exec-path (file-name-directory filename)))) | ||
(delete-dups exec-path)) | ||
|
||
(eask-start | ||
(eask-pkg-init) | ||
(eask--add-bin-exec-path) | ||
(setq commander-args (cdr argv)) | ||
(if-let* ((command (eask-argv 0)) | ||
(exe (executable-find command))) | ||
(load-file exe) | ||
(message "Executable `%s`.. not found" command))) | ||
|
||
;;; exec.el ends here |