Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</p>


# tea/cli 0.31.2
# tea/cli 0.32.0

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

Expand Down Expand Up @@ -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].

&nbsp;

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/app.help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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\`
Expand Down
6 changes: 3 additions & 3 deletions src/app.magic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions src/hooks/useExec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,18 +225,19 @@ 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<void>[] = []
const abracadabra = TEA_MAGIC?.split(":").includes("abracadabra")

for await (const entry of pantry.ls()) {
if (found) break
const p = pantry.getProvides(entry).then(providers => {
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)
Expand Down
2 changes: 1 addition & 1 deletion src/prefab/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default async function install(pkg: Package, logger?: Logger): Promise<In
`${gray('v')}${pkg.version}`
].join(gray('/'))

if (env.TEA_MAGIC === "prompt") {
if (env.TEA_MAGIC?.split(":").includes("prompt")) {
if (!Deno.isatty(Deno.stdin.rid)) {
throw new Error("TEA_MAGIC=prompt but stdin is not a tty")
}
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ it(suite, "tea /bin/ls", async function() {
})

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

it(suite, "tea http-server --help (via npx provider)", async function() {
this.sandbox.join("foo").mkdir().join("bar").touch()
await this.run({ args: ["http-server", "--help"] })
})

it(suite, "tea pkg --version", async function() {
await this.run({ args: ["pkg", "--version"] })
})