File tree Expand file tree Collapse file tree 2 files changed +17
-13
lines changed
Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -9,24 +9,23 @@ packages you need for different projects as you navigate in your shell.
99pkgx 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
Original file line number Diff line number Diff line change 11import readLines from "libpkgx/utils/read-lines.ts" ;
22import { readAll , writeAll } from "jsr:@std/io" ;
33import { Path , utils } from "libpkgx" ;
4+ import { existsSync } from "node:fs" ;
45const { flatmap } = utils ;
56
67export default async function (
@@ -90,7 +91,9 @@ export default async function (
9091}
9192
9293function 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 ] ;
You can’t perform that action at this time.
0 commit comments