Skip to content

Commit be7ade3

Browse files
authored
Merge pull request #19 from pkgxdev/quiet
Use `pkgx --quiet` where sensible
2 parents 01f3ff0 + 480923f commit be7ade3

10 files changed

+27
-21
lines changed

mash

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env -S pkgx --quiet bash
22

33
set -eo pipefail
44

@@ -17,7 +17,7 @@ if ! command -v pkgx >/dev/null; then
1717
fi
1818
if ! command -v curl >/dev/null; then
1919
curl() {
20-
pkgx curl "$@"
20+
pkgx --quiet curl "$@"
2121
}
2222
fi
2323

@@ -70,7 +70,7 @@ run() {
7070
}
7171

7272
if [ -z "$1" ]; then
73-
curl -Ssf https://pkgxdev.github.io/mash/ | pkgx jq '.categories[]' --raw-output | sort | uniq
73+
curl -Ssf https://pkgxdev.github.io/mash/ | pkgx --quiet jq '.categories[]' --raw-output | sort | uniq
7474
exit 0
7575
elif [[ "$1" == *"/"* ]]; then
7676
# fully quaified name not a category
@@ -79,9 +79,9 @@ elif [[ "$1" == *"/"* ]]; then
7979
run u/$cmd "$@"
8080
elif [[ -z "$2" ]]; then
8181
curl -Ssf https://pkgxdev.github.io/mash/$1/ |
82-
pkgx jq -r '.scripts[] | [.cmd, .description] | @tsv' |
82+
pkgx --quiet jq -r '.scripts[] | [.cmd, .description] | @tsv' |
8383
awk 'BEGIN {FS="\t"; print "| Script | Description |"; print "|-|-|"} {printf("| %s | %s |\n", $1, $2)}' |
84-
pkgx gum format
84+
pkgx --quiet gum format
8585
else
8686
cmd=$1/$2
8787
shift; shift

scripts/cache

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ shift
99

1010
case "$cmd" in
1111
neophile|neophilia|neophiliac)
12-
exec pkgx mash "pkgx/upgrade" "$@";;
12+
exec pkgx --quiet mash "pkgx/upgrade" "$@";;
1313
ls|upgrade|prune)
14-
exec pkgx mash "pkgx/$cmd" "$@";;
14+
exec pkgx --quiet mash "pkgx/$cmd" "$@";;
1515
--help)
1616
usage;;
1717
*)

scripts/demo-test-pattern

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env -S pkgx bash
1+
#!/usr/bin/env -S pkgx --quiet bash
22
printf " "
33
for b in 0 1 2 3 4 5 6 7; do printf " 4${b}m "; done
44
echo

scripts/ls.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
pkgx mash pkgx/ensure ruby "$0" | pkgx gum format
3+
pkgx --quiet mash pkgx/ensure ruby "$0" | pkgx --quiet gum format
44
exit 0
55

66
#!/usr/bin/ruby

scripts/magic.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/sh
22

33
handler=$(cat <<EoHndlr
4-
if [ -t 2 ] && [ \$1 != pkgx ] && pkgx pkgx^1 --silent --provider \$1; then
5-
if pkgx gum confirm "^^ run that with \\\`pkgx\\\`?"; then
4+
if [ -t 2 ] && [ \$1 != pkgx ] && pkgx --quiet pkgx^1 --silent --provider \$1; then
5+
if pkgx --quiet gum confirm "^^ run that with \\\`pkgx\\\`?"; then
66
pkgx "\$@"
77
else
88
return 127

scripts/pantry-inventory.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env -S pkgx deno^1.40 run --ext=ts --allow-net=dist.pkgx.dev --allow-read --allow-env --allow-ffi --unstable-ffi
1+
#!/usr/bin/env -S pkgx --quiet deno^1.40 run --ext=ts --allow-net=dist.pkgx.dev --allow-read --allow-env --allow-ffi --unstable-ffi
22

33
import { hooks, semver } from "https://deno.land/x/[email protected]/mod.ts"
44
const { usePantry, useInventory } = hooks

scripts/prune.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env -S pkgx deno~1.39 run --unstable -A --ext=ts
1+
#!/usr/bin/env -S pkgx --quiet deno~1.39 run --unstable -A --ext=ts
22

33
import { hooks, semver, SemVer, utils, plumbing, Installation } from "https://deno.land/x/[email protected]/mod.ts"
44
import { Command } from "https://deno.land/x/[email protected]/command/mod.ts"

scripts/run

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#!/usr/bin/env -S pkgx +deno bash -eo pipefail
1+
#!/usr/bin/env -S pkgx --quiet +deno bash -eo pipefail
22

3-
eval "$(pkgx --shellcode)"
3+
eval "$(pkgx --quiet --shellcode)"
44

55
get_parameters() {
66
deno run --allow-read --allow-env - <<EoTS

scripts/stub.sh

+11-5
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,20 @@ if [ "$#" -gt 1 ]; then
77
exit 1
88
fi
99

10-
pkgx +$1 >/dev/null
10+
pkgx --quiet +$1 >/dev/null
11+
major_version=$(pkgx --version | cut -d' ' -f2 | cut -d. -f1)
12+
minor_version=$(pkgx --version | cut -d' ' -f2 | cut -d. -f2)
1113

1214
f=$(mktemp)
1315

14-
cat <<EoSH > "$f"
15-
#!/bin/sh
16-
exec pkgx $1 "\$@"
17-
EoSH
16+
if ! [ "$major_version" -ge 2 -a "$minor_version" -ge 4 ]; then
17+
echo '#!/bin/sh' > "$f"
18+
echo "exec pkgx --quiet $1 \"\$@\"" >> "$f"
19+
elif [ $(uname) = Darwin -a "$(command -v pkgx)" = "/usr/local/bin/pkgx" ]; then
20+
echo "#!/usr/local/bin/pkgx -q! $1" > "$f"
21+
else
22+
echo "#!/usr/bin/env -S pkgx -q! $1" > "$f"
23+
fi
1824

1925
sudo install -m 0755 "$f" /usr/local/bin/$1
2026

scripts/upgrade.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env -S pkgx deno~1.39 run --ext=ts --allow-read --unstable --allow-net --allow-ffi --allow-write --allow-env --allow-run
1+
#!/usr/bin/env -S pkgx --quiet deno~1.39 run --ext=ts --allow-read --unstable --allow-net --allow-ffi --allow-write --allow-env --allow-run
22

33
import { hooks, Path, plumbing, semver, SemVer } from "https://deno.land/x/[email protected]/mod.ts"
44
import { walk } from "https://deno.land/[email protected]/fs/mod.ts"

0 commit comments

Comments
 (0)