Skip to content

Commit

Permalink
feature: Adapt -a/--all option for archives command (#83)
Browse files Browse the repository at this point in the history
* feature: Adapat -a/--all option for archives command

* add test

* changelog
  • Loading branch information
jcs090218 authored Dec 20, 2022
1 parent 30024b5 commit 0c829ea
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
* Fix void function `eask-source` to `eask-f-source` (#75)
* Fix upcoming breaking changes from `package-build` (#65)
* Add support for `elisp-lint` (#79)
* Adapt `-a`/`--all` option for archives command (#83)

## 0.7.x
> Released Sep 08, 2022
Expand Down
1 change: 0 additions & 1 deletion cmds/core/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ function startCommand(commands, count) {

let command = commands[count];

console.log('');
console.log('[RUN]: ' + command);
let splitted = command.split(' ');

Expand Down
38 changes: 27 additions & 11 deletions lisp/core/archives.el
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,33 @@
(message (concat " %-" eask--length-name "s %-" eask--length-url "s %-" eask--length-priority "s")
name url (or priority 0))))

(defun eask--print-archive-alist (alist)
"Print the archvie ALIST."
(let* ((names (mapcar #'car alist))
(eask--length-name (format "%s" (eask-seq-str-max names)))
(urls (mapcar #'cdr alist))
(eask--length-url (format "%s" (eask-seq-str-max urls)))
(priorities (mapcar #'cdr package-archive-priorities))
(eask--length-priority (format "%s" (eask-seq-str-max priorities))))
(mapc #'eask--print-archive alist)))

(eask-start
(if package-archives
(progn
(let* ((names (mapcar #'car package-archives))
(eask--length-name (format "%s" (eask-seq-str-max names)))
(urls (mapcar #'cdr package-archives))
(eask--length-url (format "%s" (eask-seq-str-max urls)))
(priorities (mapcar #'cdr package-archive-priorities))
(eask--length-priority (format "%s" (eask-seq-str-max priorities))))
(mapc #'eask--print-archive package-archives))
(eask-info "(Total of %s archives)" (length package-archives)))
(eask-info "(No archive has been selected)")))
(cond
((eask-all-p)
(eask-info "List all available archives:")
(eask-msg "")
(eask--print-archive-alist eask-source-mapping)
(eask-msg "")
(eask-info "(Total of %s archive%s available)" (length eask-source-mapping)
(eask--sinr eask-source-mapping "" "s")))
(package-archives
(eask-info "List archives that are currently using:")
(eask-msg "")
(eask--print-archive-alist package-archives)
(eask-msg "")
(eask-info "(Total of %s archive%s listed)" (length package-archives)
(eask--sinr package-archives "" "s")))
(t
(eask-info "(No archive has been selected)"))))

;;; core/archives.el ends here
12 changes: 6 additions & 6 deletions lisp/core/run.el
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
"Print all available scripts."
(eask-msg "available via `eask run-script`")
(eask-msg "")
(let* ((keywords (mapcar #'car (reverse eask-scripts)))
(offset (eask-seq-str-max keywords))
(let* ((keys (mapcar #'car (reverse eask-scripts)))
(offset (eask-seq-str-max keys))
(fmt (concat " %-" (eask-2str offset) "s %s")))
(dolist (keyword keywords)
(eask-msg fmt keyword (cdr (assoc keyword eask-scripts))))
(dolist (key keys)
(eask-msg fmt key (cdr (assoc key eask-scripts))))
(eask-msg "")
(eask-info "(Total of %s available script%s)" (length keywords)
(eask--sinr keywords "" "s"))))
(eask-info "(Total of %s available script%s)" (length keys)
(eask--sinr keys "" "s"))))

(defun eask--export-command (command)
"Export COMMAND instruction."
Expand Down
1 change: 1 addition & 0 deletions test/commands/local/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ cd "./test/mini.emacs.pkg/"
echo "Testing local commands..."
eask info
eask archives
eask archives --all
eask list --depth=0
eask concat

Expand Down

0 comments on commit 0c829ea

Please sign in to comment.