diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6100c6ce..1ceb6106 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -36,6 +36,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
* Add command `commnad` for custom commands (#195)
* Merge the two commands `run` and `command` (#196)
* Add `melpazoid` command (#202)
+* Add `source` command and its subcommands (#203)
## 0.8.x
> Released Mar 08, 2023
diff --git a/cmds/core/source.js b/cmds/core/source.js
new file mode 100644
index 00000000..7ad46049
--- /dev/null
+++ b/cmds/core/source.js
@@ -0,0 +1,38 @@
+/**
+ * Copyright (C) 2023 the Eask authors.
+ *
+ * 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 this program. If not, see .
+ */
+
+"use strict";
+
+exports.command = ['source '];
+exports.desc = UTIL.hide_cmd('Add/Remove source from DSL');
+exports.builder = function (yargs) {
+ yargs.usage(`${exports.desc}
+
+Usage: eask source [options..]`)
+ .commandDir('../source/')
+ .demandCommand();
+
+ /* XXX: Configure only in the menu. */
+ if (UTIL.cmd_count() == 1) {
+ yargs.positional(
+ '', {
+ description: 'type of the control',
+ });
+ }
+}
+
+exports.handler = async (argv) => {};
diff --git a/cmds/link/delete.js b/cmds/link/delete.js
index 0bd5d171..c25c370a 100644
--- a/cmds/link/delete.js
+++ b/cmds/link/delete.js
@@ -17,7 +17,7 @@
"use strict";
-exports.command = ['delete [names..]'];
+exports.command = ['delete [names..]', 'remove [names..]'];
exports.desc = 'Delete local linked packages';
exports.builder = yargs => yargs
.positional(
diff --git a/cmds/source/add.js b/cmds/source/add.js
new file mode 100644
index 00000000..256bc8c4
--- /dev/null
+++ b/cmds/source/add.js
@@ -0,0 +1,36 @@
+/**
+ * Copyright (C) 2023 the Eask authors.
+ *
+ * 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 this program. If not, see .
+ */
+
+"use strict";
+
+exports.command = ['add [url]'];
+exports.desc = 'Add an archive source';
+exports.builder = yargs => yargs
+ .positional(
+ '', {
+ description: 'name of the archive',
+ type: 'array',
+ })
+ .positional(
+ '[url]', {
+ description: 'link to the archive',
+ type: 'string',
+ });
+
+exports.handler = async (argv) => {
+ await UTIL.e_call(argv, 'source/add', argv.name, argv.url);
+};
diff --git a/cmds/source/delete.js b/cmds/source/delete.js
new file mode 100644
index 00000000..1e16b78a
--- /dev/null
+++ b/cmds/source/delete.js
@@ -0,0 +1,32 @@
+/**
+ * Copyright (C) 2023 the Eask authors.
+ *
+ * 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 this program. If not, see .
+ */
+
+"use strict";
+
+exports.command = ['delete ', 'remove '];
+exports.desc = 'Remove an archive source';
+exports.builder = yargs => yargs
+ .positional(
+ '', {
+ description: 'name of the archive',
+ type: 'array',
+ });
+
+exports.handler = async (argv) => {
+ await UTIL.e_call(argv, 'source/delete', argv.name);
+};
+
diff --git a/cmds/source/list.js b/cmds/source/list.js
new file mode 100644
index 00000000..51672e29
--- /dev/null
+++ b/cmds/source/list.js
@@ -0,0 +1,26 @@
+/**
+ * Copyright (C) 2023 the Eask authors.
+ *
+ * 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 this program. If not, see .
+ */
+
+"use strict";
+
+exports.command = ['list'];
+exports.desc = 'List all source information';
+
+exports.handler = async (argv) => {
+ await UTIL.e_call(argv, 'source/list');
+};
+
diff --git a/docs/content/en/Getting-Started/Basic-Usage/_index.md b/docs/content/en/Getting-Started/Basic-Usage/_index.md
index 785c89d5..ad222eee 100644
--- a/docs/content/en/Getting-Started/Basic-Usage/_index.md
+++ b/docs/content/en/Getting-Started/Basic-Usage/_index.md
@@ -146,6 +146,7 @@ Here is a list of known nested subcommands:
- eask link
- eask lint
- eask run
+- eask source
- eask test
## ๐ Knowing your `elpa` directory
diff --git a/docs/content/en/Getting-Started/Commands-and-options.md b/docs/content/en/Getting-Started/Commands-and-options.md
index 9927d142..ef165edf 100644
--- a/docs/content/en/Getting-Started/Commands-and-options.md
+++ b/docs/content/en/Getting-Started/Commands-and-options.md
@@ -328,12 +328,12 @@ $ eask [GLOBAL-OPTIONS] run script [NAMES..]
Run the command.
+Alias: `cmd`
+
```sh
$ eask [GLOBAL-OPTIONS] run command [NAMES..]
```
-Alias: `cmd`
-
## ๐ eask docker
Launch specified Emacs version in a Docker container.
@@ -540,6 +540,8 @@ $ eask [GLOBAL-OPTIONS] link add
Deletes the link for the given packages.
+Alias: `remove`
+
```sh
$ eask [GLOBAL-OPTIONS] link delete [names..]
```
@@ -558,6 +560,8 @@ $ eask [GLOBAL-OPTIONS] link list
Delete `.eask` from the current workspace.
+Alias: `.eask`
+
```sh
$ eask [GLOBAL-OPTIONS] clean workspace
```
@@ -568,8 +572,6 @@ $ eask [GLOBAL-OPTIONS] clean workspace
$ eask clean workspace -g
```
-Alias: `.eask`
-
## ๐ eask clean elc
Delete all `.elc` files. This would respect to your `Eask` file.
@@ -582,12 +584,12 @@ $ eask [GLOBAL-OPTIONS] clean elc
Delete dist subdirectory.
+Alias: `distribution`
+
```sh
$ eask [GLOBAL-OPTIONS] clean dist
```
-Alias: `distribution`
-
## ๐ eask clean autoloads
Remove generated autoloads file.
@@ -623,13 +625,13 @@ This command is the combination of all other clean commands.
- `clean pkg-file`
- `clean log-file`
+Alias: `everything`
+
```sh
$ eask [GLOBAL-OPTIONS] clean all
```
-Alias: `everything`
-
-# ๐ฉ Linter
+# ๐ฉ Linting
Commands that lint your Emacs package.
@@ -711,12 +713,12 @@ $ eask [GLOBAL-OPTIONS] lint declare [FILES..]
Run [relint](https://github.com/mattiase/relint).
+Alias: `lint relint`
+
```sh
$ eask [GLOBAL-OPTIONS] lint regexps [FILES..]
```
-Alias: `lint relint`
-
# ๐ฉ Testing
## ๐ eask test activate
@@ -769,6 +771,40 @@ $ eask [GLOBAL-OPTIONS] test melpazoid [DIRECTORIES..]
๐ก If **[DIRECTORIES..]** is not passed in; it will use the current workspace instead.
{{< /hint >}}
+# ๐ฉ Control DSL
+
+List of commands that control DSL.
+
+## ๐ eask source add
+
+Add an archive source.
+
+```sh
+$ eask [GLOBAL-OPTIONS] source add [URL]
+```
+
+## ๐ eask source delete
+
+Remove an archive source.
+
+Alias: `remove`
+
+```sh
+$ eask [GLOBAL-OPTIONS] source delete
+```
+
+## ๐ eask source list
+
+List all source information.
+
+```sh
+$ eask [GLOBAL-OPTIONS] source list
+```
+
+{{< hint info >}}
+๐ก This command is the same as `$ eask archives`!
+{{< /hint >}}
+
# ๐ฉ Utilities
Other helper commands.
diff --git a/docs/content/en/Getting-Started/Introduction.md b/docs/content/en/Getting-Started/Introduction.md
index 04a2177a..6476c7f1 100644
--- a/docs/content/en/Getting-Started/Introduction.md
+++ b/docs/content/en/Getting-Started/Introduction.md
@@ -114,11 +114,11 @@ list.
### ๐ Core commands
-- [ ] [FEAT] Add `publish` command; to publish package to eask archive?
+- [ ] [FEAT] Add `publish` command; to publish the package to the eask archive?
### ๐ Eask-file commands
-- [ ] [FEAT] Add `add-source` command
+- N/A
## ๐ Underlying Projects
diff --git a/docs/content/zh-TW/Getting-Started/Basic-Usage/_index.md b/docs/content/zh-TW/Getting-Started/Basic-Usage/_index.md
index 0a6a0e69..fca68134 100644
--- a/docs/content/zh-TW/Getting-Started/Basic-Usage/_index.md
+++ b/docs/content/zh-TW/Getting-Started/Basic-Usage/_index.md
@@ -141,6 +141,7 @@ Positionals:
- eask link
- eask lint
- eask run
+- eask source
- eask test
## ๐ ไบ่งฃไฝ ็ `elpa` ็ฎ้
diff --git a/docs/content/zh-TW/Getting-Started/Commands-and-options.md b/docs/content/zh-TW/Getting-Started/Commands-and-options.md
index 766efbbb..515f57a8 100644
--- a/docs/content/zh-TW/Getting-Started/Commands-and-options.md
+++ b/docs/content/zh-TW/Getting-Started/Commands-and-options.md
@@ -324,12 +324,12 @@ $ eask [GLOBAL-OPTIONS] run script [NAMES..]
้่กๆไปคใ
+ๅฅๅ: `cmd`
+
```sh
$ eask [GLOBAL-OPTIONS] run command [NAMES..]
```
-ๅฅๅ: `cmd`
-
## ๐ eask docker
ๅจ Docker ๅฎนๅจไธญๅๅๆๅฎ็ Emacs ็ๆฌ
@@ -352,7 +352,7 @@ $ eask docker 26.1 info
## ๐ eask archives
-ๅๅบๆๆๅ
ๆชๆกใ
+ๅๅบๆๆๅ
ๆบใ
```sh
$ eask [GLOBAL-OPTIONS] archives
@@ -360,7 +360,7 @@ $ eask [GLOBAL-OPTIONS] archives
## ๐ eask search
-ๅพๆชๆกไธญๆ็ดขๅ
ใ
+ๅพๅ
ๆบไธญๆ็ดขๅ
ใ
```sh
$ eask [GLOBAL-OPTIONS] search [QUEIRES..]
@@ -392,7 +392,7 @@ $ eask [GLOBAL-OPTIONS] outdated [--depth]
## ๐ eask refresh
-ๅทๆฐๅ
archivesใ
+ๅทๆฐๅ
ๆบใ
```sh
$ eask [GLOBAL-OPTIONS] refresh
@@ -527,6 +527,8 @@ $ eask [GLOBAL-OPTIONS] link add
ๅช้ค็ตฆๅฎๅ
็้ๆฅใ
+ๅฅๅ: `remove`
+
```sh
$ eask [GLOBAL-OPTIONS] link delete [names..]
```
@@ -545,19 +547,18 @@ $ eask [GLOBAL-OPTIONS] link list
ๅพ็ถๅๅทฅไฝๅไธญๅช้ค `.eask` ใ
+ๅฅๅ: `.eask`
+
```sh
$ eask [GLOBAL-OPTIONS] clean workspace
```
โ๏ธ ไธ่ฆๆๅฎ้ธ้
`--config, -c`๏ผๅฆๅๅฎๆๅช้คไฝ ็ๆดๅ `~/.emacs.d`ใ
-
```elisp
$ eask clean workspace -g
```
-ๅฅๅ: `.eask`
-
## ๐ eask clean elc
ๅช้คๆๆ `.elc` ๆไปถใ ้ๅฐๅฐ้ๆจ็ `Eask` ๆไปถใ
@@ -570,12 +571,12 @@ $ eask [GLOBAL-OPTIONS] clean elc
ๅช้ค dist ๅญ็ฎ้ใ
+ๅฅๅ: `distribution`
+
```sh
$ eask [GLOBAL-OPTIONS] clean dist
```
-ๅฅๅ: `distribution`
-
## ๐ eask clean autoloads
ๅช้ค็ๆ็ autoload ๆไปถใ
@@ -611,13 +612,13 @@ $ eask [GLOBAL-OPTIONS] clean log-file
- `clean pkg-file`
- `clean log-file`
+ๅฅๅ: `everything`
+
```sh
$ eask [GLOBAL-OPTIONS] clean all
```
-ๅฅๅ: `everything`
-
-# ๐ฉ ๆฃๆฅๅจ
+# ๐ฉ ๆฃๆฅ
ๅฐ Emacs ๅ
้ฒ่ก lint ็ๅฝไปคใ
@@ -699,12 +700,12 @@ $ eask [GLOBAL-OPTIONS] lint declare [FILES..]
Run [relint](https://github.com/mattiase/relint).
+ๅฅๅ: `lint relint`
+
```sh
$ eask [GLOBAL-OPTIONS] lint regexps [FILES..]
```
-ๅฅๅ: `lint relint`
-
# ๐ฉ ๆธฌ่ฉฆๆกๆถ
## ๐ eask test activate
@@ -757,6 +758,40 @@ $ eask [GLOBAL-OPTIONS] test melpazoid [DIRECTORIES..]
๐ก ๅฆๆๆชๅณๅ
ฅ **[DIRECTORIES..]**๏ผๅฎๅฐไฝฟ็จ็ฎๅๅทฅไฝ็ฉบ้ใ
{{< /hint >}}
+# ๐ฉ ๆงๅถ DSL
+
+ๆงๅถ DSL ็ๆไปคๅ่กจใ
+
+## ๐ eask source add
+
+ๆฐๅขไธๅๅ
ๆบใ
+
+```sh
+$ eask [GLOBAL-OPTIONS] source add [URL]
+```
+
+## ๐ eask source delete
+
+็งป้คไธๅๅ
ๆบใ
+
+ๅฅๅ: `remove`
+
+```sh
+$ eask [GLOBAL-OPTIONS] source delete
+```
+
+## ๐ eask source list
+
+ๅๅบๆๆๅ
ๆบใ
+
+```sh
+$ eask [GLOBAL-OPTIONS] source list
+```
+
+{{< hint info >}}
+๐ก ๆไปค่ `$ eask archives` ็ธๅ!
+{{< /hint >}}
+
# ๐ฉ ๅฏฆ็จๅทฅๅ
ท
ๅ
ถไป่ผๅฉๅฝไปคใ
diff --git a/lisp/_prepare.el b/lisp/_prepare.el
index 42a4cd65..3807a3e1 100644
--- a/lisp/_prepare.el
+++ b/lisp/_prepare.el
@@ -1118,6 +1118,20 @@ This uses function `locate-dominating-file' to look up directory tree."
(nongnu-devel . "https://elpa.nongnu.org/nongnu-devel/"))
"Mapping of source name and url.")
+(defun eask-2url (url)
+ "Convert secure/insecure URL."
+ (if (and url
+ (gnutls-available-p)
+ (eask-network-insecure-p))
+ (eask-s-replace "https://" "http://" url)
+ url))
+
+(defun eask-source-url (name &optional location)
+ "Get the source url by it's NAME and LOCATION."
+ (setq location (or location (cdr (assq (intern (eask-2str name)) eask-source-mapping)))
+ location (eask-2url location))
+ location)
+
(defvar eask-package nil)
(defvar eask-package-desc nil) ; package descriptor
(defvar eask-package-descriptor nil)
@@ -1299,12 +1313,8 @@ argument COMMAND."
(when (symbolp name) (setq name (eask-2str name))) ; ensure to string, accept symbol
(when (assoc name package-archives)
(eask-error "Multiple definition of source `%s'" name))
- (setq location (or location (cdr (assq (intern name) eask-source-mapping))))
+ (setq location (eask-source-url name location))
(unless location (eask-error "Unknown package archive `%s'" name))
- (when (and location
- (gnutls-available-p)
- (not (eask-network-insecure-p)))
- (setq location (eask-s-replace "https://" "http://" location)))
(add-to-list 'package-archives (cons name location) t))
(defun eask-f-source-priority (archive-id &optional priority)
diff --git a/lisp/core/archives.el b/lisp/core/archives.el
index 2aeeda74..6a36dcb5 100644
--- a/lisp/core/archives.el
+++ b/lisp/core/archives.el
@@ -25,7 +25,7 @@
(priority (assoc name package-archive-priorities))
(priority (cdr priority)))
(message (concat " %-" eask--length-name "s %-" eask--length-url "s %-" eask--length-priority "s")
- name url (or priority 0))))
+ name (eask-2url url) (or priority 0))))
(defun eask--print-archive-alist (alist)
"Print the archvie ALIST."
diff --git a/lisp/help/source/add b/lisp/help/source/add
new file mode 100644
index 00000000..bd897e92
--- /dev/null
+++ b/lisp/help/source/add
@@ -0,0 +1,7 @@
+
+๐ก The given source name is not found in our database. You have following options:
+
+Options are,
+
+ - [ ] Pass in one extra argument to specify an `[url]`
+ - [ ] Edit variable `eask-source-mapping` and create a pull request to https://github.com/emacs-eask/cli
diff --git a/lisp/help/source/delete b/lisp/help/source/delete
new file mode 100644
index 00000000..58ad8f0b
--- /dev/null
+++ b/lisp/help/source/delete
@@ -0,0 +1,4 @@
+
+๐ก The given source name is not found in your Eask-file. List all the archives with:
+
+ $ eask source list
diff --git a/lisp/source/add.el b/lisp/source/add.el
new file mode 100644
index 00000000..4ac55bdd
--- /dev/null
+++ b/lisp/source/add.el
@@ -0,0 +1,120 @@
+;;; source/add.el --- Add an archive source -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;;
+;; Commmand use to add an archive source
+;;
+;; $ eask source add
+;;
+;;
+;; Positionals:
+;;
+;; name of the archive
+;; link to the archive
+;;
+
+;;; Code:
+
+(let ((dir (file-name-directory (nth 1 (member "-scriptload" command-line-args)))))
+ (load (expand-file-name "_prepare.el"
+ (locate-dominating-file dir "_prepare.el"))
+ nil t))
+
+(defun eask--source-from-mapping (name url)
+ "Return t if NAME and URL matched our database."
+ (string= (eask-source-url name) url))
+
+(defun eask--source-add (name url exists)
+ "Add an archive source by NAME.
+
+If argument URL is nil; ignore the insertion.
+
+Arguments EXISTS is used to print the information."
+ (let* ((style-sym (string-match "([ \t\n\r]*source[ \t\n\r]*[']+" (buffer-string)))
+ (name-str (if style-sym (concat "'" name)
+ (concat "\"" name "\"")))
+ (built-in (eask--source-from-mapping name url)))
+ (if (and url (not built-in))
+ (insert "(source " name-str " \"" url "\")\n")
+ (insert "(source " name-str ")\n"))
+ (eask-info "(New source `%s' added and points to `%s')" name (or url (cdr exists)))))
+
+(defun eask--source-write (name url exists)
+ "Write source construct by NAME and URL.
+
+The argument URL can be nil.
+
+The argument EXISTS is use to search for correct position to insert new source."
+ (with-current-buffer (find-file eask-file)
+ (goto-char (point-min))
+ (cond
+ (exists
+ (if (re-search-forward (concat "([ \t\n\r]*source[ \t\n\r]*['\"]+" name) nil t)
+ (let ((start (point))
+ (built-in (eask--source-from-mapping name url)))
+ (when (string= "\"" (string (char-after)))
+ (cl-incf start))
+ (re-search-forward "[ \t\r\n\")]*" nil t) ; Forward to non-space characters!
+ (forward-char -1)
+ (when (string= "\n" (string (char-after)))
+ (forward-char -1))
+ (pcase (string (char-after))
+ (")"
+ (unless built-in
+ (insert " \"" url "\"")))
+ ("\""
+ (if built-in
+ (delete-region start (save-window-excursion
+ (search-forward ")" nil t)
+ (1- (point))))
+ (let ((old (thing-at-point 'string))
+ (new (concat "\"" url "\"")))
+ (delete-region (point) (+ (point) (length old)))
+ (insert new)))))
+ (eask-info "(Changed archive `%s''s location from `%s' to `%s')"
+ name (cdr exists) url))
+ (goto-char (point-max))
+ (eask--source-add name url exists)))
+ (t
+ (if (re-search-forward "([ \t\n\r]*source[ \t\n\r]*['\"]+" nil t)
+ (forward-paragraph)
+ (goto-char (point-max)))
+ (eask--source-add name url exists)))
+ (save-buffer)))
+
+(defun eask--source-ask-if-overwrite (name url)
+ "Ask source overwrite if needed.
+
+Arguments NAME and URL are main arguments for this command."
+ (if-let ((exists (assoc name package-archives))
+ (old-url (cdr exists)))
+ (cond ((string= old-url url)
+ (eask-info "(Nothing has changed due to the URLs are the same)"))
+ ((yes-or-no-p
+ (format
+ (concat
+ "The archive `%s' is already exists and currently points to `%s'.
+
+Do you want to overwrite it? ")
+ name old-url))
+ (eask--source-write name url exists))
+ (t
+ (eask-info "(Nothing has changed, aborted)")))
+ (eask--source-write name url nil)))
+
+(eask-start
+ (let* ((args (eask-args))
+ (name (nth 0 args))
+ (url (nth 1 args)))
+ (cond
+ (url (eask--source-ask-if-overwrite name url))
+ (t
+ (if-let* ((archive (assoc (eask-intern name) eask-source-mapping))
+ (name (car archive))
+ (name (eask-2str name))
+ (url (eask-source-url name))) ; Use the URL from our database!
+ (eask--source-ask-if-overwrite name url)
+ (eask-info "(Invalid source name, `%s')" name)
+ (eask-help "source/add"))))))
+
+;;; source/add.el ends here
diff --git a/lisp/source/delete.el b/lisp/source/delete.el
new file mode 100644
index 00000000..67173d21
--- /dev/null
+++ b/lisp/source/delete.el
@@ -0,0 +1,39 @@
+;;; source/delete.el --- Remove an archive source -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;;
+;; Commmand use to remove an archive source
+;;
+;; $ eask source delete
+;;
+;;
+;; Positionals:
+;;
+;; name of the archive
+;;
+
+;;; Code:
+
+(let ((dir (file-name-directory (nth 1 (member "-scriptload" command-line-args)))))
+ (load (expand-file-name "_prepare.el"
+ (locate-dominating-file dir "_prepare.el"))
+ nil t))
+
+(defun eask--source-delete (name)
+ "Delete an archive source by NAME."
+ (with-current-buffer (find-file eask-file)
+ (goto-char (point-min))
+ (when (re-search-forward (concat "([ \t\n\r]*source[ \t\n\r]*['\"]+" name) nil t)
+ (delete-region (line-beginning-position) (1+ (line-end-position)))
+ (eask-info "(Delete source `%s')" name))
+ (save-buffer)))
+
+(eask-start
+ (let* ((args (eask-args))
+ (name (nth 0 args)))
+ (if-let ((exists (assoc name package-archives)))
+ (eask--source-delete name)
+ (eask-info "(Invalid source name, `%s')" name)
+ (eask-help "source/delete"))))
+
+;;; source/delete.el ends here
diff --git a/lisp/source/list.el b/lisp/source/list.el
new file mode 100644
index 00000000..7d645dbc
--- /dev/null
+++ b/lisp/source/list.el
@@ -0,0 +1,20 @@
+;;; source/list.el --- List all source information -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;;
+;; Commmand use to list all source information
+;;
+;; $ eask source list
+;;
+
+;;; Code:
+
+(let ((dir (file-name-directory (nth 1 (member "-scriptload" command-line-args)))))
+ (load (expand-file-name "_prepare.el"
+ (locate-dominating-file dir "_prepare.el"))
+ nil t))
+
+(eask-start
+ (eask-call "core/archives"))
+
+;;; source/list.el ends here
diff --git a/src/util.js b/src/util.js
index 280b8ada..0f08bb4d 100644
--- a/src/util.js
+++ b/src/util.js
@@ -236,15 +236,6 @@ async function e_call(argv, script, ...args) {
});
}
-/**
- * Hide command unless options `--show-hidden` is specified.
- * @param { string | boolean } description - to display when comand is showed,
- * @return Return a string to show command, else we return false.
- */
-function hide_cmd(description) {
- return (process.argv.includes('--show-hidden')) ? description : false;
-}
-
/**
* Get the command count, not including options.
* @return Return a size of the command array.
@@ -255,6 +246,18 @@ function cmd_count() {
return args.length;
}
+/**
+ * Hide command unless options `--show-hidden` is specified.
+ * @param { string | boolean } description - to display when comand is showed,
+ * @return Return a string to show command, else we return false.
+ */
+function hide_cmd(description) {
+ if ((process.argv.includes('--show-hidden'))
+ || 1 <= cmd_count()) // When display in submenu!
+ return description;
+ return false;
+}
+
/*
* Module Exports
diff --git a/test/commands/local/run.sh b/test/commands/local/run.sh
index 9fdf3226..a253d2ee 100644
--- a/test/commands/local/run.sh
+++ b/test/commands/local/run.sh
@@ -71,7 +71,7 @@ eask generate recipe -y
#eask generate license gpl-3.0 # XXX: Avoid API rate limit exceeded error
eask generate ignore elisp
-# Linter
+# Linting
eask lint checkdoc
eask lint declare
eask lint elint
@@ -86,7 +86,7 @@ eask lint regexps
# Testing
eask test activate
-# Clean up
+# Cleaning
eask clean .eask
eask clean elc
eask clean dist
@@ -95,6 +95,11 @@ eask clean pkg-file
eask clean log-file
eask clean all
+# Control DSL
+eask source add test "https://test.elpa.com"
+eask source delete test
+eask source list
+
# Util
eask locate
eask upgrade-eask