Skip to content

Commit 123b103

Browse files
authored
Merge pull request #82 from pkgxdev/typo
typo
2 parents 9078e60 + 41d2354 commit 123b103

1 file changed

Lines changed: 44 additions & 36 deletions

File tree

pkgm.ts

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ function standardPath() {
2424
break;
2525
case "linux":
2626
homebrewPrefix = `/home/linuxbrew/.linuxbrew:${
27-
Deno.env.get("HOME")
27+
Deno.env.get(
28+
"HOME",
29+
)
2830
}/.linuxbrew`;
2931
break;
3032
}
@@ -87,7 +89,7 @@ if (parsedArgs.help || parsedArgs._[0] == "help") {
8789
{
8890
let all_success = true;
8991
for (const arg of args) {
90-
if (!await uninstall(arg)) {
92+
if (!(await uninstall(arg))) {
9193
all_success = false;
9294
}
9395
}
@@ -132,8 +134,8 @@ async function install(args: string[], basePath: string) {
132134
const pkgx = get_pkgx();
133135

134136
const [json] = await query_pkgx(pkgx, args);
135-
const pkg_prefixes = json.pkgs.map((x) =>
136-
`${x.pkg.project}/v${x.pkg.version}`
137+
const pkg_prefixes = json.pkgs.map(
138+
(x) => `${x.pkg.project}/v${x.pkg.version}`,
137139
);
138140

139141
// get the pkgx_dir this way as it is a) more reliable and b) the only way if
@@ -200,9 +202,10 @@ async function install(args: string[], basePath: string) {
200202
}
201203

202204
if (
203-
!Deno.env.get("PATH")?.split(":")?.includes(
204-
new Path(basePath).join("bin").string,
205-
)
205+
!Deno.env
206+
.get("PATH")
207+
?.split(":")
208+
?.includes(new Path(basePath).join("bin").string)
206209
) {
207210
console.error(
208211
"%c! warning:",
@@ -282,7 +285,7 @@ async function query_pkgx(
282285
args = args.map((x) => `+${x}`);
283286

284287
const env: Record<string, string> = {
285-
"PATH": standardPath(),
288+
PATH: standardPath(),
286289
};
287290
const set = (key: string) => {
288291
const x = Deno.env.get(key);
@@ -316,8 +319,7 @@ async function query_pkgx(
316319
stdout: "piped",
317320
env,
318321
clearEnv: true,
319-
})
320-
.spawn();
322+
}).spawn();
321323

322324
const status = await proc.status;
323325

@@ -328,22 +330,24 @@ async function query_pkgx(
328330
const out = await proc.output();
329331
const json = JSON.parse(new TextDecoder().decode(out.stdout));
330332

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-
);
333+
const pkgs = (
334+
json.pkgs as { path: string; project: string; version: string }[]
335+
).map((x) => {
336+
return {
337+
path: new Path(x.path),
338+
pkg: { project: x.project, version: new SemVer(x.version) },
339+
};
340+
});
340341
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];
342+
return [
343+
{
344+
pkg,
345+
pkgs,
346+
env: json.env,
347+
runtime_env: json.runtime_env,
348+
},
349+
env,
350+
];
347351
}
348352

349353
async function mirror_directory(dst: string, src: string, prefix: string) {
@@ -465,10 +469,7 @@ async function create_v_symlinks(prefix: string) {
465469
}
466470
}
467471

468-
function expand_runtime_env(
469-
json: JsonResponse,
470-
basePath: string,
471-
) {
472+
function expand_runtime_env(json: JsonResponse, basePath: string) {
472473
const { runtime_env, pkgs } = json;
473474

474475
//FIXME this combines all runtime env which is strictly overkill
@@ -498,7 +499,11 @@ function expand_runtime_env(
498499

499500
// DUMB but easiest way to fix a bug
500501
const rv2: Record<string, Record<string, string>> = {};
501-
for (const { pkg: { project } } of json.pkgs) {
502+
for (
503+
const {
504+
pkg: { project },
505+
} of json.pkgs
506+
) {
502507
rv2[project] = rv;
503508
}
504509

@@ -530,7 +535,10 @@ function get_pkgx() {
530535

531536
async function* ls() {
532537
for (
533-
const path of [new Path("/usr/local/pkgs"), Path.home().join(".local/pkgs")]
538+
const path of [
539+
new Path("/usr/local/pkgs"),
540+
Path.home().join(".local/pkgs"),
541+
]
534542
) {
535543
if (!path.isDirectory()) continue;
536544
const dirs = [path];
@@ -554,7 +562,7 @@ async function uninstall(arg: string) {
554562
found = (await hooks.usePantry().find(arg))?.[0];
555563
} catch {
556564
console.error(
557-
"%ci pantry not found, trying to find package another way",
565+
"%c pantry not found, trying to find package another way",
558566
"color:blue",
559567
);
560568
}
@@ -671,8 +679,8 @@ async function outdated() {
671679
for (const { path, pkg } of pkgs) {
672680
const versions = await hooks.useInventory().get(pkg);
673681
// console.log(pkg, graph[pkg.project]);
674-
const constrained_versions = versions.filter((x) =>
675-
graph[pkg.project].satisfies(x) && x.gt(pkg.version)
682+
const constrained_versions = versions.filter(
683+
(x) => graph[pkg.project].satisfies(x) && x.gt(pkg.version),
676684
);
677685
if (constrained_versions.length) {
678686
console.log(
@@ -726,8 +734,8 @@ async function update() {
726734

727735
for (const { pkg } of pkgs) {
728736
const versions = await hooks.useInventory().get(pkg);
729-
const constrained_versions = versions.filter((x) =>
730-
graph[pkg.project].satisfies(x) && x.gt(pkg.version)
737+
const constrained_versions = versions.filter(
738+
(x) => graph[pkg.project].satisfies(x) && x.gt(pkg.version),
731739
);
732740

733741
if (constrained_versions.length) {

0 commit comments

Comments
 (0)