@@ -23,9 +23,9 @@ function standardPath() {
2323 homebrewPrefix = "/opt/homebrew" ; // /usr/local is already in the path
2424 break ;
2525 case "linux" :
26- homebrewPrefix = `/home/linuxbrew/.linuxbrew:${
27- Deno . env . get ( "HOME" )
28- } /.linuxbrew`;
26+ homebrewPrefix = `/home/linuxbrew/.linuxbrew:${ Deno . env . get (
27+ "HOME" ,
28+ ) } /.linuxbrew`;
2929 break ;
3030 }
3131 if ( homebrewPrefix ) {
@@ -87,7 +87,7 @@ if (parsedArgs.help || parsedArgs._[0] == "help") {
8787 {
8888 let all_success = true ;
8989 for ( const arg of args ) {
90- if ( ! await uninstall ( arg ) ) {
90+ if ( ! ( await uninstall ( arg ) ) ) {
9191 all_success = false ;
9292 }
9393 }
@@ -132,8 +132,8 @@ async function install(args: string[], basePath: string) {
132132 const pkgx = get_pkgx ( ) ;
133133
134134 const [ json ] = await query_pkgx ( pkgx , args ) ;
135- const pkg_prefixes = json . pkgs . map ( ( x ) =>
136- `${ x . pkg . project } /v${ x . pkg . version } `
135+ const pkg_prefixes = json . pkgs . map (
136+ ( x ) => `${ x . pkg . project } /v${ x . pkg . version } ` ,
137137 ) ;
138138
139139 // get the pkgx_dir this way as it is a) more reliable and b) the only way if
@@ -200,9 +200,10 @@ async function install(args: string[], basePath: string) {
200200 }
201201
202202 if (
203- ! Deno . env . get ( "PATH" ) ?. split ( ":" ) ?. includes (
204- new Path ( basePath ) . join ( "bin" ) . string ,
205- )
203+ ! Deno . env
204+ . get ( "PATH" )
205+ ?. split ( ":" )
206+ ?. includes ( new Path ( basePath ) . join ( "bin" ) . string )
206207 ) {
207208 console . error (
208209 "%c! warning:" ,
@@ -242,8 +243,8 @@ async function shim(args: string[], basePath: string) {
242243 for await ( const entry of Deno . readDir ( bin_prefix . string ) ) {
243244 if ( ! entry . isFile && ! entry . isSymlink ) continue ;
244245 const name = entry . name ;
245- const quick_shim = Deno . build . os == "darwin" &&
246- pkgx == "/usr/local/bin/pkgx" ;
246+ const quick_shim =
247+ Deno . build . os == "darwin" && pkgx == "/usr/local/bin/pkgx" ;
247248 const interpreter = quick_shim
248249 ? "/usr/local/bin/pkgx"
249250 : "/usr/bin/env -S pkgx" ;
@@ -282,7 +283,7 @@ async function query_pkgx(
282283 args = args . map ( ( x ) => `+${ x } ` ) ;
283284
284285 const env : Record < string , string > = {
285- " PATH" : standardPath ( ) ,
286+ PATH : standardPath ( ) ,
286287 } ;
287288 const set = ( key : string ) => {
288289 const x = Deno . env . get ( key ) ;
@@ -316,8 +317,7 @@ async function query_pkgx(
316317 stdout : "piped" ,
317318 env,
318319 clearEnv : true ,
319- } )
320- . spawn ( ) ;
320+ } ) . spawn ( ) ;
321321
322322 const status = await proc . status ;
323323
@@ -328,22 +328,24 @@ async function query_pkgx(
328328 const out = await proc . output ( ) ;
329329 const json = JSON . parse ( new TextDecoder ( ) . decode ( out . stdout ) ) ;
330330
331- const pkgs =
332- ( json . pkgs as { path : string ; project : string ; version : string } [ ] ) . map (
333- ( x ) => {
334- return {
335- path : new Path ( x . path ) ,
336- pkg : { project : x . project , version : new SemVer ( x . version ) } ,
337- } ;
338- } ,
339- ) ;
331+ const pkgs = (
332+ json . pkgs as { path : string ; project : string ; version : string } [ ]
333+ ) . map ( ( x ) => {
334+ return {
335+ path : new Path ( x . path ) ,
336+ pkg : { project : x . project , version : new SemVer ( x . version ) } ,
337+ } ;
338+ } ) ;
340339 const pkg = pkgs . find ( ( x ) => `+${ x . pkg . project } ` == args [ 0 ] ) ! ;
341- return [ {
342- pkg,
343- pkgs,
344- env : json . env ,
345- runtime_env : json . runtime_env ,
346- } , env ] ;
340+ return [
341+ {
342+ pkg,
343+ pkgs,
344+ env : json . env ,
345+ runtime_env : json . runtime_env ,
346+ } ,
347+ env ,
348+ ] ;
347349}
348350
349351async function mirror_directory ( dst : string , src : string , prefix : string ) {
@@ -391,18 +393,16 @@ async function mirror_directory(dst: string, src: string, prefix: string) {
391393}
392394
393395async function symlink ( src : string , dst : string ) {
394- for (
395- const base of [
396- "bin" ,
397- "sbin" ,
398- "share" ,
399- "lib" ,
400- "libexec" ,
401- "var" ,
402- "etc" ,
403- "ssl" , // FIXME for ca-certs
404- ]
405- ) {
396+ for ( const base of [
397+ "bin" ,
398+ "sbin" ,
399+ "share" ,
400+ "lib" ,
401+ "libexec" ,
402+ "var" ,
403+ "etc" ,
404+ "ssl" , // FIXME for ca-certs
405+ ] ) {
406406 const foo = join ( src , base ) ;
407407 if ( existsSync ( foo ) ) {
408408 await processEntry ( foo , join ( dst , base ) ) ;
@@ -465,10 +465,7 @@ async function create_v_symlinks(prefix: string) {
465465 }
466466}
467467
468- function expand_runtime_env (
469- json : JsonResponse ,
470- basePath : string ,
471- ) {
468+ function expand_runtime_env ( json : JsonResponse , basePath : string ) {
472469 const { runtime_env, pkgs } = json ;
473470
474471 //FIXME this combines all runtime env which is strictly overkill
@@ -498,7 +495,9 @@ function expand_runtime_env(
498495
499496 // DUMB but easiest way to fix a bug
500497 const rv2 : Record < string , Record < string , string > > = { } ;
501- for ( const { pkg : { project } } of json . pkgs ) {
498+ for ( const {
499+ pkg : { project } ,
500+ } of json . pkgs ) {
502501 rv2 [ project ] = rv ;
503502 }
504503
@@ -529,9 +528,10 @@ function get_pkgx() {
529528}
530529
531530async function * ls ( ) {
532- for (
533- const path of [ new Path ( "/usr/local/pkgs" ) , Path . home ( ) . join ( ".local/pkgs" ) ]
534- ) {
531+ for ( const path of [
532+ new Path ( "/usr/local/pkgs" ) ,
533+ Path . home ( ) . join ( ".local/pkgs" ) ,
534+ ] ) {
535535 if ( ! path . isDirectory ( ) ) continue ;
536536 const dirs = [ path ] ;
537537 let dir : Path | undefined ;
@@ -554,7 +554,7 @@ async function uninstall(arg: string) {
554554 found = ( await hooks . usePantry ( ) . find ( arg ) ) ?. [ 0 ] ;
555555 } catch {
556556 console . error (
557- "%ci pantry not found, trying to find package another way" ,
557+ "%c pantry not found, trying to find package another way" ,
558558 "color:blue" ,
559559 ) ;
560560 }
@@ -671,8 +671,8 @@ async function outdated() {
671671 for ( const { path, pkg } of pkgs ) {
672672 const versions = await hooks . useInventory ( ) . get ( pkg ) ;
673673 // console.log(pkg, graph[pkg.project]);
674- const constrained_versions = versions . filter ( ( x ) =>
675- graph [ pkg . project ] . satisfies ( x ) && x . gt ( pkg . version )
674+ const constrained_versions = versions . filter (
675+ ( x ) => graph [ pkg . project ] . satisfies ( x ) && x . gt ( pkg . version ) ,
676676 ) ;
677677 if ( constrained_versions . length ) {
678678 console . log (
@@ -726,8 +726,8 @@ async function update() {
726726
727727 for ( const { pkg } of pkgs ) {
728728 const versions = await hooks . useInventory ( ) . get ( pkg ) ;
729- const constrained_versions = versions . filter ( ( x ) =>
730- graph [ pkg . project ] . satisfies ( x ) && x . gt ( pkg . version )
729+ const constrained_versions = versions . filter (
730+ ( x ) => graph [ pkg . project ] . satisfies ( x ) && x . gt ( pkg . version ) ,
731731 ) ;
732732
733733 if ( constrained_versions . length ) {
@@ -787,8 +787,9 @@ exec ${bin_prefix}/${name} "$@"
787787}
788788
789789function datadir ( ) {
790- const default_data_home = Deno . build . os == "darwin"
791- ? "/Library/Application Support"
792- : "/.local/share" ;
790+ const default_data_home =
791+ Deno . build . os == "darwin"
792+ ? "/Library/Application Support"
793+ : "/.local/share" ;
793794 return `\${XDG_DATA_HOME:-$HOME${ default_data_home } }` ;
794795}
0 commit comments