小编the*_*per的帖子

Xcode 接管了我的 git 安装,发生了什么?

我在 MacBook Pro 上使用 git 已经很多年了,也安装了 xcode,但很少使用它。昨天不小心打开了xcode,立马关掉了。然后,我的 docker 环境中的 git 命令停止工作(git 无法检测到该目录是 git repo),所以我回到常规环境并输入 git status,并看到以下消息

You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.

Press the 'return' key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/en.lproj/License.rtf'
Run Code Online (Sandbox Code Playgroud)

如果我运行which git输出是/usr/bin/git- 这可能是 xcode 安装的 git 版本吗?发生了什么?如何恢复原来的 git 安装?谢谢

git xcode

10
推荐指数
1
解决办法
2387
查看次数

如何解决 zsh compinit:MacOS 上的不安全目录问题(其他解决方案失败)

我知道这里有很多这个问题的副本,但他们的所有答案都建议添加

ZSH_DISABLE_COMPFIX="true"
Run Code Online (Sandbox Code Playgroud)

到我的 ~/.zshrc 文件的顶部。我已经这样做了,但每次打开 zsh 时,我都会受到欢迎

zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]?
Run Code Online (Sandbox Code Playgroud)

似乎其他问这个问题的人在第一个样本中没有引用真实的引号,但我已经添加了。我还运行了 source ~/.zshrc 据我所知,它重新加载了 zshrc 配置。这仍然给了我上述警告。我不确定这些细节中的任何一个是否相关,但我会包括它们:

  • 这是运行 Big Sur 的 M1 Macbook 上的新 zsh 安装
  • 我还在 zsh 之上安装了 Oh My Zsh
  • 我之前运行了几个导出命令来设置我的 nvm 目录,但我认为这无关紧要

知道如何解决此权限问题吗?谢谢

编辑:

comaudit 回报

/usr/local/share/zsh/site-functions
/usr/local/share/zsh
Run Code Online (Sandbox Code Playgroud)

此外,这里是我的 ~/.zshrc 文件中的其他非标准条目(按顺序排列,但中间有一些内置内容):

ZSH_DISABLE_COMPFIX="true"
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
export PATH="/usr/local/opt/icu4c/bin:$PATH"
export PATH="/usr/local/opt/icu4c/sbin:$PATH"
export PATH=$HOME/bin:/usr/local/bin:$PATH
plugins=(git)
source $ZSH/oh-my-zsh.sh
zstyle :compinstall filename '/Users/jonahsaltzman/.zshrc'
# End …
Run Code Online (Sandbox Code Playgroud)

zsh oh-my-zsh

5
推荐指数
2
解决办法
4647
查看次数

...args 的泛型类型?

我有一个函数time

const time = <T>(fn: (...args: any[]) => Promise<T>, ...args: any[]): Promise<T> => {
  return new Promise(async (resolve, reject) => {
    const timer = setTimeout(() => reject(`Error: ${fn.name} timed out`), ms)
    try {
      resolve(await fn.bind(thisArg)(...args))
    } catch(err) {
      reject(err)
    } finally {
      clearTimeout(timer)
    }
  })
}
Run Code Online (Sandbox Code Playgroud)

我想知道是否有办法避免使用anyas 的类型...args?具体来说,因为我想将签名 ( )...args中的类型与(函数的第二个参数)的类型相关联。这两个是相同的参数,所以看起来它们应该通过泛型相关。我想到了这样的事情:fnfn: (...args: any[]) => Promise<T>...argstime...args

const time = <T, U>(fn: (...args: U[]) => Promise<T>, ...args: U[]): Promise<T>
Run Code Online (Sandbox Code Playgroud)

但这似乎是错误的,因为参数并不都是同一类型。...args …

generics types typescript

4
推荐指数
1
解决办法
3353
查看次数

标签 统计

generics ×1

git ×1

oh-my-zsh ×1

types ×1

typescript ×1

xcode ×1

zsh ×1