From b037af10188a7885efd655e9da75d03f87edaf57 Mon Sep 17 00:00:00 2001
From: Max Howell
Date: Thu, 11 May 2023 10:18:22 -0400
Subject: [PATCH] `provides: bin/tea-foo` => `tea foo` & not `foo`
---
README.md | 5 +++--
src/app.help.ts | 2 +-
src/app.magic.ts | 6 +++---
src/hooks/useExec.ts | 5 +++--
src/prefab/install.ts | 2 +-
tests/integration/cli.test.ts | 6 ++++--
6 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/README.md b/README.md
index 57907591f..32b2f4ee0 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@
-# tea/cli 0.31.2
+# tea/cli 0.32.0
`tea` puts the whole open source ecosystem at your fingertips:
@@ -176,7 +176,7 @@ sh <(curl https://tea.xyz)
Our one-liner sets up in `~/.tea` and enables magic but it actually can do a
whole bunch more. For all the deets and other ways to install (including [our
-GitHub Action]) check out the manual [docs.tea.xyz].
+GitHub Action]) check out the manual [docs.tea.xyz/getting-started].
@@ -232,6 +232,7 @@ $ deno task compile && ./tea
[docs.tea.xyz]: https://docs.tea.xyz
+[docs.tea.xyz/getting-started]: https://docs.tea.xyz/getting-started/install-tea
[deno]: https://deno.land
[TypeScript]: https://www.typescriptlang.org
[discussion]: https://github.com/orgs/teaxyz/discussions
diff --git a/src/app.help.ts b/src/app.help.ts
index 05f1cada3..3389471fe 100644
--- a/src/app.help.ts
+++ b/src/app.help.ts
@@ -62,7 +62,7 @@ export default async function help() {
environment variables:
TEA_PREFIX stow packages here
- TEA_MAGIC if shell magic is active, \`TEA_MAGIC=0\` disables it
+ TEA_MAGIC \`0\` force disables magic, \`prompt\` confirms installs
CLICOLOR see https://bixense.com/clicolors
VERBOSE {-1: silent, 0: default, 1: verbose, 2: debug}
DEBUG alias for \`VERBOSE=2\`
diff --git a/src/app.magic.ts b/src/app.magic.ts
index 9ead7e214..292dfa12b 100644
--- a/src/app.magic.ts
+++ b/src/app.magic.ts
@@ -38,7 +38,7 @@ export default function(self: Path, shell?: string) {
function command_not_found_handler {
if [ "\${TEA_MAGIC:-}" != 0 -a -x "${d}"/tea ]; then
- "${d}"/tea -- $*
+ TEA_MAGIC="abracadabra:$TEA_MAGIC" "${d}"/tea -- $*
else
echo "zsh: command not found: $*" >&2
exit 127
@@ -102,7 +102,7 @@ export default function(self: Path, shell?: string) {
end
function fish_command_not_found
- "${d}"/tea -- $argv
+ TEA_MAGIC="abracadabra:$TEA_MAGIC" "${d}"/tea -- $argv
end
"${d}"/tea --env --keep-going --silent --dry-run=w/trace | source
@@ -123,7 +123,7 @@ export default function(self: Path, shell?: string) {
fi
function command_not_found_handle {
- "${d}"/tea -- $*
+ TEA_MAGIC="abracadabra:$TEA_MAGIC" "${d}"/tea -- $*
}
`
default:
diff --git a/src/hooks/useExec.ts b/src/hooks/useExec.ts
index b820c9ab5..75a68385a 100644
--- a/src/hooks/useExec.ts
+++ b/src/hooks/useExec.ts
@@ -225,10 +225,11 @@ export async function which(arg0: string | undefined) {
return false
}
- const { TEA_PKGS } = useEnv()
+ const { TEA_PKGS, TEA_MAGIC } = useEnv()
const pantry = usePantry()
let found: { project: string, constraint: semver.Range, shebang: string[] } | undefined
const promises: Promise[] = []
+ const abracadabra = TEA_MAGIC?.split(":").includes("abracadabra")
for await (const entry of pantry.ls()) {
if (found) break
@@ -236,7 +237,7 @@ export async function which(arg0: string | undefined) {
for (const provider of providers) {
if (found) {
return
- } else if (provider == arg0) {
+ } else if (provider == arg0 || (!abracadabra && provider == `tea-${arg0}`)) {
const inenv = TEA_PKGS?.split(":")
.map(pkgutils.parse)
.find(x => x.project == entry.project)
diff --git a/src/prefab/install.ts b/src/prefab/install.ts
index 6d3c65c6a..945979a8f 100644
--- a/src/prefab/install.ts
+++ b/src/prefab/install.ts
@@ -25,7 +25,7 @@ export default async function install(pkg: Package, logger?: Logger): Promise