Skip to content

Commit

Permalink
don’t prompt to install XcodeCLT when syncing
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Apr 30, 2023
1 parent 12c9669 commit cb104df
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</p>


# tea/cli 0.31.0
# tea/cli 0.31.1

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

Expand Down
14 changes: 13 additions & 1 deletion src/hooks/useSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import useRun, { RunOptions } from "./useRun.ts"
import useLogger from "./useLogger.ts"
import * as semver from "semver"
import Path from "path"
import { host } from "../utils/index.ts";

export default async function() {
const logger = useLogger()
Expand Down Expand Up @@ -52,10 +53,21 @@ async function git(...args: (string | Path)[]) {
const pkg = await useCellar().has({ project: 'git-scm.org', constraint: new semver.Range('*') })
const git = (pkg?.path ?? usr())?.join("bin/git")
if (git) await run({cmd: [git, ...args]})
throw new Error("no-git") // caught above to trigger http download instead

function usr() {
// only return /usr/bin if in the PATH so user can explicitly override this
return Deno.env.get("PATH")?.split(":")?.includes("/usr/bin") ? new Path("/usr") : undefined
const rv = Deno.env.get("PATH")?.split(":")?.includes("/usr/bin") ? new Path("/usr") : undefined

/// don’t cause macOS to abort and then prompt the user to install the XcodeCLT
//FIXME test! but this is hard to test without docker images or something!
if (host().platform == 'darwin') {
if (new Path("/Library/Developer/CommandLineTools/usr/bin/git").isExecutableFile()) return rv
if (new Path("/Application/Xcode.app").isDirectory()) return rv
return
}

return rv
}
}

Expand Down

0 comments on commit cb104df

Please sign in to comment.