Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions cmds/core/exec-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@

"use strict";

exports.command = ['path', 'exec-path'];
exports.command = ['path [patterns..]', 'exec-path [patterns..]'];
exports.desc = 'Print the PATH (exec-path) from workspace';
exports.builder = {
patterns: {
description: 'patterns you want to search (regex)',
requiresArg: false,
type: 'array',
},
};

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'core/exec-path');
await UTIL.e_call(argv, 'core/exec-path', argv.patterns);
};
13 changes: 10 additions & 3 deletions cmds/core/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@

"use strict";

exports.command = ['files'];
exports.desc = 'Print the list of all package files';
exports.command = ['files [patterns..]'];
exports.desc = 'Print all package files';
exports.builder = {
patterns: {
description: 'patterns you want to search (wildcard)',
requiresArg: false,
type: 'array',
},
};

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'core/files');
await UTIL.e_call(argv, 'core/files', argv.patterns);
};
11 changes: 9 additions & 2 deletions cmds/core/load-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@

"use strict";

exports.command = ['load-path'];
exports.command = ['load-path [patterns..]'];
exports.desc = 'Print the load-path from workspace';
exports.builder = {
patterns: {
description: 'patterns you want to search (regex)',
requiresArg: false,
type: 'array',
},
};

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'core/load-path');
await UTIL.e_call(argv, 'core/load-path', argv.patterns);
};
114 changes: 57 additions & 57 deletions docs/content/en/Getting Started/Basic Usage.md

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions docs/content/en/Getting Started/Commands and options.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,25 +184,31 @@ Print the `PATH` environment variable of this project.
Alias: `exec-path`

```sh
$ eask [GLOBAL-OPTIONS] path
$ eask [GLOBAL-OPTIONS] path [PATTERNS..]
```

Optionally, you can pass in `[PATTERNS..]` to perform the search.

## 🔍 eask load-path

Print the load path containing the dependencies of the current project.

```sh
$ eask [GLOBAL-OPTIONS] load-path
$ eask [GLOBAL-OPTIONS] load-path [PATTERNS..]
```

Optionally, you can pass in `[PATTERNS..]` to perform the search.

## 🔍 eask files

Print the list of all package files.

```sh
$ eask [GLOBAL-OPTIONS] files
$ eask [GLOBAL-OPTIONS] files [PATTERNS..]
```

If `[PATTERNS..]` are defined, it will display files that match that pattern.

## 🔍 eask exec

Execute the system command with the given arguments.
Expand Down
15 changes: 12 additions & 3 deletions lisp/core/exec-path.el
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,23 @@
(file-name-directory (nth 1 (member "-scriptload" command-line-args))))
nil t)

(eask-load "core/load-path")

(defun eask--print-exec-path (path)
"Print out the PATH."
(message "%s" path))

(eask-start
(eask-pkg-init)
(mapc #'eask--print-exec-path exec-path)
(eask-msg "")
(eask-info "(Total of %s exec-path)" (length exec-path)))
(let* ((patterns (eask-args))
(exec-path (if patterns
(cl-remove-if-not #'eask--filter-path exec-path)
exec-path)))
(eask-msg "")
(mapc #'eask--print-exec-path exec-path)
(if (zerop (length exec-path))
(eask-info "(No exec-path found)")
(eask-msg "")
(eask-info "(Total of %s exec-path)" (length exec-path)))))

;;; core/exec-path.el ends here
4 changes: 2 additions & 2 deletions lisp/core/exec.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; core/exec.el --- Execute command with correct load-path set up -*- lexical-binding: t; -*-
;;; core/exec.el --- Execute command with correct PATH set up -*- lexical-binding: t; -*-

;;; Commentary:
;;
Expand All @@ -9,7 +9,7 @@
;;
;; Initialization options:
;;
;; [args..] execute command with correct load-path set up
;; [args..] execute command with correct PATH set up
;;

;;; Code:
Expand Down
11 changes: 8 additions & 3 deletions lisp/core/files.el
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@
(message "%s" filename))

(eask-start
(let ((files (eask-package-files)))
(let* ((patterns (eask-args))
(files (if patterns
(eask-expand-file-specs patterns)
(eask-package-files))))
(mapc #'eask--print-filename files)
(eask-msg "")
(eask-info "(Total of %s item%s listed)" (length files) (eask--sinr files "" "s"))))
(if (zerop (length files))
(eask-info "(No package files found)")
(eask-msg "")
(eask-info "(Total of %s item%s listed)" (length files) (eask--sinr files "" "s")))))

;;; core/files.el ends here
19 changes: 16 additions & 3 deletions lisp/core/load-path.el
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,23 @@
"Print out the PATH."
(message "%s" path))

(defun eask--filter-path (path)
"Filter the PATH out by search regex."
(cl-some (lambda (regex)
(string-match-p regex path))
(eask-args)))

(eask-start
(eask-pkg-init)
(mapc #'eask--print-load-path load-path)
(eask-msg "")
(eask-info "(Total of %s load-path)" (length load-path)))
(let* ((patterns (eask-args))
(load-path (if patterns
(cl-remove-if-not #'eask--filter-path load-path)
load-path)))
(eask-msg "")
(mapc #'eask--print-load-path load-path)
(if (zerop (length load-path))
(eask-info "(No load-path found)")
(eask-msg "")
(eask-info "(Total of %s load-path)" (length load-path)))))

;;; core/load-path.el ends here
6 changes: 6 additions & 0 deletions test/commands/local/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ eask archives --all
eask list --depth=0
eask concat

# PATH environment
eask path
eask path bin
eask load-path
eask load-path bin

# Preparation
eask prepare --dev
eask package
Expand Down