mirror of
https://github.com/janet-lang/janet
synced 2025-02-24 12:10:00 +00:00
Add list-pkgs and list-installed to jpm.
This commit is contained in:
parent
68a12d1d17
commit
a45509d28e
@ -2,6 +2,7 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
## Unreleased - ???
|
## Unreleased - ???
|
||||||
|
- Add `jpm list-installed` subcommand to see which packages are installed.
|
||||||
- Add `math/int-min`, `math/int-max`, `math/int32-min`, and `math/int32-max` for getting integer limits.
|
- Add `math/int-min`, `math/int-max`, `math/int32-min`, and `math/int32-max` for getting integer limits.
|
||||||
- The gc interval is now autotuned, to prevent very bad gc behavior.
|
- The gc interval is now autotuned, to prevent very bad gc behavior.
|
||||||
- Improvements to the bytecode compiler, Janet will now generate more efficient bytecode.
|
- Improvements to the bytecode compiler, Janet will now generate more efficient bytecode.
|
||||||
|
19
jpm
19
jpm
@ -1106,6 +1106,9 @@ Unprivileged project subcommands:
|
|||||||
run rule : run a rule. Can also run custom rules added via (phony "task" [deps...] ...)
|
run rule : run a rule. Can also run custom rules added via (phony "task" [deps...] ...)
|
||||||
or (rule "ouput.file" [deps...] ...).
|
or (rule "ouput.file" [deps...] ...).
|
||||||
rules : list rules available with run.
|
rules : list rules available with run.
|
||||||
|
list-installed : list installed packages in the current syspath.
|
||||||
|
list-pkgs (search) : list packages in the package listing that the contain the string search.
|
||||||
|
If no search pattern is given, prints the entire package listing.
|
||||||
rule-tree (root rule) (depth) : Print a nice tree to see what rules depend on other rules.
|
rule-tree (root rule) (depth) : Print a nice tree to see what rules depend on other rules.
|
||||||
Optionally provide a root rule to start printing from, and a
|
Optionally provide a root rule to start printing from, and a
|
||||||
max depth to print. Without these options, all rules will print
|
max depth to print. Without these options, all rules will print
|
||||||
@ -1186,6 +1189,20 @@ Flags are:
|
|||||||
(def ks (sort (seq [k :keys (dyn :rules)] k)))
|
(def ks (sort (seq [k :keys (dyn :rules)] k)))
|
||||||
(each k ks (print k)))
|
(each k ks (print k)))
|
||||||
|
|
||||||
|
(defn list-installed
|
||||||
|
[]
|
||||||
|
(each x (os/dir (find-manifest-dir))
|
||||||
|
(if (string/has-suffix? ".jdn" x)
|
||||||
|
(print (string/slice x 0 -5)))))
|
||||||
|
|
||||||
|
(defn list-pkgs
|
||||||
|
[&opt search]
|
||||||
|
(def pkgs-mod (require "pkgs"))
|
||||||
|
(eachk p (get-in pkgs-mod ['packages :value] [])
|
||||||
|
(if search
|
||||||
|
(if (string/find search p) (print p))
|
||||||
|
(print p))))
|
||||||
|
|
||||||
(defn update-pkgs
|
(defn update-pkgs
|
||||||
[]
|
[]
|
||||||
(install-git (dyn :pkglist default-pkglist)))
|
(install-git (dyn :pkglist default-pkglist)))
|
||||||
@ -1227,6 +1244,8 @@ Flags are:
|
|||||||
"debug-repl" jpm-debug-repl
|
"debug-repl" jpm-debug-repl
|
||||||
"rule-tree" show-rule-tree
|
"rule-tree" show-rule-tree
|
||||||
"show-paths" show-paths
|
"show-paths" show-paths
|
||||||
|
"list-installed" list-installed
|
||||||
|
"list-pkgs" list-pkgs
|
||||||
"clear-cache" clear-cache
|
"clear-cache" clear-cache
|
||||||
"clear-manifest" clear-manifest
|
"clear-manifest" clear-manifest
|
||||||
"run" local-rule
|
"run" local-rule
|
||||||
|
9
jpm.1
9
jpm.1
@ -139,6 +139,15 @@ date or too large, clear-cache will remove the cache and jpm will rebuild it
|
|||||||
when needed. clear-cache is a global command, so a project.janet is not
|
when needed. clear-cache is a global command, so a project.janet is not
|
||||||
required.
|
required.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.BR list-installed
|
||||||
|
List all installed packages in the current syspath.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.BR list-pkgs [\fBsearch\fR]
|
||||||
|
List all package aliases in the current package listing that contain the given search string.
|
||||||
|
If no search string is given, prints the entire listing.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR clear-manifest
|
.BR clear-manifest
|
||||||
jpm creates a manifest directory that contains a list of all installed files.
|
jpm creates a manifest directory that contains a list of all installed files.
|
||||||
|
@ -497,7 +497,7 @@
|
|||||||
(defmacro eachk
|
(defmacro eachk
|
||||||
"Loop over each key in ds. Returns nil."
|
"Loop over each key in ds. Returns nil."
|
||||||
[x ds & body]
|
[x ds & body]
|
||||||
(each-template x ds :each body))
|
(each-template x ds :keys body))
|
||||||
|
|
||||||
(defmacro eachp
|
(defmacro eachp
|
||||||
"Loop over each (key, value) pair in ds. Returns nil."
|
"Loop over each (key, value) pair in ds. Returns nil."
|
||||||
|
@ -315,4 +315,9 @@
|
|||||||
|
|
||||||
(assert (= 40 counter) "if-with 1")
|
(assert (= 40 counter) "if-with 1")
|
||||||
|
|
||||||
|
(def a @[])
|
||||||
|
(eachk x [:a :b :c :d]
|
||||||
|
(array/push a x))
|
||||||
|
(assert (deep= (range 4) a) "eachk 1")
|
||||||
|
|
||||||
(end-suite)
|
(end-suite)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user