Skip to content

Commit cb104df

Browse files
committed
don’t prompt to install XcodeCLT when syncing
1 parent 12c9669 commit cb104df

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</p>
1717

1818

19-
# tea/cli 0.31.0
19+
# tea/cli 0.31.1
2020

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

src/hooks/useSync.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import useRun, { RunOptions } from "./useRun.ts"
33
import useLogger from "./useLogger.ts"
44
import * as semver from "semver"
55
import Path from "path"
6+
import { host } from "../utils/index.ts";
67

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

5658
function usr() {
5759
// only return /usr/bin if in the PATH so user can explicitly override this
58-
return Deno.env.get("PATH")?.split(":")?.includes("/usr/bin") ? new Path("/usr") : undefined
60+
const rv = Deno.env.get("PATH")?.split(":")?.includes("/usr/bin") ? new Path("/usr") : undefined
61+
62+
/// don’t cause macOS to abort and then prompt the user to install the XcodeCLT
63+
//FIXME test! but this is hard to test without docker images or something!
64+
if (host().platform == 'darwin') {
65+
if (new Path("/Library/Developer/CommandLineTools/usr/bin/git").isExecutableFile()) return rv
66+
if (new Path("/Application/Xcode.app").isDirectory()) return rv
67+
return
68+
}
69+
70+
return rv
5971
}
6072
}
6173

0 commit comments

Comments
 (0)