Skip to content

Commit f510e1c

Browse files
committed
Document mash pkgx/ensure
1 parent 2105171 commit f510e1c

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

docs/pkgx.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ If you only specified `make` rather than `/usr/bin/make` or separating with
9797

9898
{% endhint %}
9999

100-
101100
## Dumping the Environment
102101

103102
If you don’t specify anything to run, `pkgx` will install any `+pkg`s and then
@@ -118,20 +117,35 @@ gum version 0.14.5
118117

119118
For this mode we can also output JSON: `pkgx +gum --json`.
120119

121-
122120
## Quietening Output
123121

124122
```sh
125123
$ pkgx --quiet gum format 'download progress is still shown'
126124
# ^^ supresses resolving/syncing etc. messages but not download progress info
125+
# `pkgx -q` is the same
127126

128127
```sh
129128
pkgx --silent gum format 'no output at all'
130129
# ^^ silences everything, even errors
130+
# ^^ `pkgx -qq` is the same
131131
```
132132

133133
Note that this only effects `pkgx` *not the tools you run with `pkgx`*.
134134

135+
## Ensuring Packages
136+
137+
In some cases you don’t want to use a `pkgx` package if the user has that
138+
package already installed to their system. For these cases we provide an
139+
`ensure` script:
140+
141+
```sh
142+
$ pkgx mash pkgx/ensure git --version
143+
# ^^ runs system `git` if installed, otherwise installs the `pkgx` pkg
144+
145+
$ eval "$(pkgx mash pkgx/ensure +git)"
146+
# ^^ adds pkgx git to the environment *unless* it is installed to the system
147+
```
148+
135149
## Other Common Needs
136150

137151
`pkgx` is not a package manager. Thus the command itself doesn’t typically
@@ -146,7 +160,7 @@ Longer term we will make a tool `pkgq` to help with these operations.
146160
ensure you have (any) newer versions installed use this command:
147161

148162
```sh
149-
$ pkgx mash pkgx/cache upgrade
163+
$ pkgx mash pkgx/upgrade
150164
updating: /Users/mxcl/.pkgx/python.org/v3.11.11
151165
# snip…
152166
```
@@ -156,7 +170,7 @@ updating: /Users/mxcl/.pkgx/python.org/v3.11.11
156170
The `pkgx` download cache can get large over time. To prune older versions:
157171

158172
```sh
159-
$ pkgx mash pkgx/cache prune
173+
$ pkgx mash pkgx/prune
160174
pruning: ~/.pkgx/deno.land/v1.39.4
161175
pruning: ~/.pkgx/deno.land/v1.46.3
162176
# snip…
@@ -170,7 +184,7 @@ reinstall them next time you need them.
170184
ie. what versions *could be* run by `pkgx`:
171185

172186
```sh
173-
$ pkgx mash pkgx/pantry-inventory git
187+
$ pkgx mash pkgx/inventory git
174188
2.38.1
175189
2.39.0
176190
# snip…
@@ -179,7 +193,7 @@ $ pkgx mash pkgx/pantry-inventory git
179193
### Listing What is Downloaded
180194

181195
```sh
182-
$ mash pkgx/cache ls
196+
$ mash pkgx/ls
183197
184198
Parent Directory │Version
185199
────────────────────────────────┼──────────

0 commit comments

Comments
 (0)