Skip to content

Commit fca934f

Browse files
committed
If installed via brew, don’t prefix with pkgx
Also, use `--quiet`
1 parent 773b7fa commit fca934f

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,23 @@ packages you need for different projects as you navigate in your shell.
99
pkgx dev integrate
1010
```
1111

12-
We support macOS & Linux, **Bash** & **Zsh**. PRs are very welcome for more
13-
shells.
12+
`dev` requires `pkgx` but at your preference:
1413

15-
> [!IMPORTANT]
16-
>
17-
> `pkgx` is a required dependency.
18-
>
19-
> ```sh
20-
> brew install pkgxdev/made/pkgx || sh <(curl https://pkgx.sh)
21-
> ```
14+
```sh
15+
brew install pkgxdev/made/dev
16+
dev integrate
17+
```
18+
19+
We support macOS & Linux, **Bash** & **Zsh**. PRs are very welcome to support
20+
more shells.
2221

2322
> [!NOTE]
2423
>
25-
> `pkgx dev integrate` looks for and edits known `shell.rc` files adding one
24+
> `dev integrate` looks for and edits known `shell.rc` files adding one
2625
> line:
2726
>
2827
> ```sh
29-
> eval "$(pkgx dev --shellcode)"
28+
> eval "$(dev --shellcode)"
3029
> ```
3130
>
3231
> If you don’t trust us (good on you), then do a dry run first:
@@ -35,7 +34,9 @@ shells.
3534
> pkgx dev integrate --dry-run
3635
> ```
3736
>
38-
> If you like, preview the shellcode: `pkgx dev --shellcode`.
37+
> If you like, preview the shellcode: `pkgx dev --shellcode`. This command
38+
> only outputs shellcode, it doesn’t modify any files or do anything else
39+
> either.
3940
4041
## Usage
4142

src/integrate.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import readLines from "libpkgx/utils/read-lines.ts";
22
import { readAll, writeAll } from "jsr:@std/io";
33
import { Path, utils } from "libpkgx";
4+
import { existsSync } from "node:fs";
45
const { flatmap } = utils;
56

67
export default async function (
@@ -90,7 +91,9 @@ export default async function (
9091
}
9192

9293
function shells(): [Path, string][] {
93-
const eval_ln = 'eval "$(pkgx dev --shellcode)"';
94+
const eval_ln = existsSync('/opt/homebrew/bin/dev') || existsSync('/usr/local/bin/dev')
95+
? 'eval "$(dev --shellcode)"'
96+
: 'eval "$(pkgx --quiet dev --shellcode)"';
9497

9598
const zdotdir = flatmap(Deno.env.get("ZDOTDIR"), Path.abs) ?? Path.home();
9699
const zshpair: [Path, string] = [zdotdir.join(".zshrc"), eval_ln];

0 commit comments

Comments
 (0)