@@ -4,15 +4,16 @@ import { ensureDir, existsSync } from "jsr:@std/fs@^1";
44import { parse as parse_args } from "jsr:@std/flags@0.224.0" ;
55import * as semver from "jsr:@std/semver@^1" ;
66
7- const standardPath = ( ( ) => {
7+ function standardPath ( ) {
88 const basePath = "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" ;
9+ // for pkgm installed via homebrew
910 const homebrew = `${ Deno . env . get ( "HOMEBREW_PREFIX" ) || "/opt/homebrew" } /bin` ;
10- if ( existsSync ( homebrew ) ) {
11+ if ( Deno . build . os === "darwin" ) {
1112 return `${ homebrew } :${ basePath } ` ;
1213 } else {
1314 return basePath ;
1415 }
15- } ) ( ) ;
16+ }
1617
1718const parsedArgs = parse_args ( Deno . args , {
1819 alias : {
@@ -28,7 +29,7 @@ if (parsedArgs.help) {
2829 args : [ "gh" , "repo" , "view" , "pkgxdev/pkgm" ] ,
2930 clearEnv : true ,
3031 env : {
31- "PATH" : standardPath ,
32+ "PATH" : standardPath ( ) ,
3233 "HOME" : Deno . env . get ( "HOME" ) ! ,
3334 } ,
3435 } ) . spawn ( ) . status ;
@@ -79,7 +80,7 @@ async function install(args: string[]) {
7980 args = args . map ( ( x ) => `+${ x } ` ) ;
8081
8182 const env : Record < string , string > = {
82- "PATH" : standardPath ,
83+ "PATH" : standardPath ( ) ,
8384 } ;
8485 const set = ( key : string ) => {
8586 const x = Deno . env . get ( key ) ;
0 commit comments