Skip to content

Commit 10ed000

Browse files
committed
provides: bin/tea-foo => tea foo & not foo
1 parent 36d64bc commit 10ed000

6 files changed

Lines changed: 15 additions & 11 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</p>
1717

1818

19-
# tea/cli 0.31.2
19+
# tea/cli 0.32.0
2020

2121
`tea` puts the whole open source ecosystem at your fingertips:
2222

@@ -176,7 +176,7 @@ sh <(curl https://tea.xyz)
176176

177177
Our one-liner sets up in `~/.tea` and enables magic but it actually can do a
178178
whole bunch more. For all the deets and other ways to install (including [our
179-
GitHub Action]) check out the manual [docs.tea.xyz].
179+
GitHub Action]) check out the manual [docs.tea.xyz/getting-started].
180180

181181
&nbsp;
182182

@@ -232,6 +232,7 @@ $ deno task compile && ./tea
232232

233233

234234
[docs.tea.xyz]: https://docs.tea.xyz
235+
[docs.tea.xyz/getting-started]: https://docs.tea.xyz/getting-started/install-tea
235236
[deno]: https://deno.land
236237
[TypeScript]: https://www.typescriptlang.org
237238
[discussion]: https://github.com/orgs/teaxyz/discussions

src/app.help.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default async function help() {
6262
6363
environment variables:
6464
TEA_PREFIX stow packages here
65-
TEA_MAGIC if shell magic is active, \`TEA_MAGIC=0\` disables it
65+
TEA_MAGIC \`0\` force disables magic, \`prompt\` confirms installs
6666
CLICOLOR see https://bixense.com/clicolors
6767
VERBOSE {-1: silent, 0: default, 1: verbose, 2: debug}
6868
DEBUG alias for \`VERBOSE=2\`

src/app.magic.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default function(self: Path, shell?: string) {
3838
3939
function command_not_found_handler {
4040
if [ "\${TEA_MAGIC:-}" != 0 -a -x "${d}"/tea ]; then
41-
"${d}"/tea -- $*
41+
TEA_MAGIC="abracadabra:$TEA_MAGIC" "${d}"/tea -- $*
4242
else
4343
echo "zsh: command not found: $*" >&2
4444
exit 127
@@ -102,7 +102,7 @@ export default function(self: Path, shell?: string) {
102102
end
103103
104104
function fish_command_not_found
105-
"${d}"/tea -- $argv
105+
TEA_MAGIC="abracadabra:$TEA_MAGIC" "${d}"/tea -- $argv
106106
end
107107
108108
"${d}"/tea --env --keep-going --silent --dry-run=w/trace | source
@@ -123,7 +123,7 @@ export default function(self: Path, shell?: string) {
123123
fi
124124
125125
function command_not_found_handle {
126-
"${d}"/tea -- $*
126+
TEA_MAGIC="abracadabra:$TEA_MAGIC" "${d}"/tea -- $*
127127
}
128128
`
129129
default:

src/hooks/useExec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,18 +225,19 @@ export async function which(arg0: string | undefined) {
225225
return false
226226
}
227227

228-
const { TEA_PKGS } = useEnv()
228+
const { TEA_PKGS, TEA_MAGIC } = useEnv()
229229
const pantry = usePantry()
230230
let found: { project: string, constraint: semver.Range, shebang: string[] } | undefined
231231
const promises: Promise<void>[] = []
232+
const abracadabra = TEA_MAGIC?.split(":").includes("abracadabra")
232233

233234
for await (const entry of pantry.ls()) {
234235
if (found) break
235236
const p = pantry.getProvides(entry).then(providers => {
236237
for (const provider of providers) {
237238
if (found) {
238239
return
239-
} else if (provider == arg0) {
240+
} else if (provider == arg0 || (!abracadabra && provider == `tea-${arg0}`)) {
240241
const inenv = TEA_PKGS?.split(":")
241242
.map(pkgutils.parse)
242243
.find(x => x.project == entry.project)

src/prefab/install.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default async function install(pkg: Package, logger?: Logger): Promise<In
2525
`${gray('v')}${pkg.version}`
2626
].join(gray('/'))
2727

28-
if (env.TEA_MAGIC === "prompt") {
28+
if (env.TEA_MAGIC?.split(":").includes("prompt")) {
2929
if (!Deno.isatty(Deno.stdin.rid)) {
3030
throw new Error("TEA_MAGIC=prompt but stdin is not a tty")
3131
}

tests/integration/cli.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ it(suite, "tea /bin/ls", async function() {
3434
})
3535

3636
it(suite, "tea chalk --version (via npx provider)", async function() {
37-
this.sandbox.join("foo").mkdir().join("bar").touch()
3837
await this.run({ args: ["chalk", "--version"] })
3938
})
4039

4140
it(suite, "tea http-server --help (via npx provider)", async function() {
42-
this.sandbox.join("foo").mkdir().join("bar").touch()
4341
await this.run({ args: ["http-server", "--help"] })
4442
})
43+
44+
it(suite, "tea pkg --version", async function() {
45+
await this.run({ args: ["pkg", "--version"] })
46+
})

0 commit comments

Comments
 (0)