2

如何安装uncrustify?我按照说明安装了 uncrustify,但是当我运行它时,它不起作用。谁能帮我安装这个工具?我想在 xcode 4 中的 Objective-C 代码上运行它。提前谢谢

4

3 回答 3

6

在 OS X Mavericks 10.9.1 上:

1-安装 brew,打开终端窗口并输入:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

它会要求您下载一些其他文件,全部回答 OK(有关更多信息,请参阅:http ://brew.sh/index_fr.html )。

2 - 安装 uncrusify,打开终端窗口类型:

brew install uncrustify

3 - 为了让你的代码更漂亮,请在https://github.com/benoitsan/BBUncrustifyPlugin-Xcode下载 BBUncrustifyPlugin-Xcode

你只需要:

  • 编译项目
  • 将文件 uncrusify.cfg 复制到您的主目录中
  • 重新启动 Xcode。

注意:使用 BBUncrustifyPlugin,您不需要使用 Automator。

4 - 重新启动 Xcode 后,使用菜单 Edit > Uncrustify Selected Files 在项目导航器中取消选中项目。

你的代码现在很漂亮!那是魔法!

post-scriptum :您可以使用以下命令轻松更改 uncrusify 配置文件:

我希望这会有所帮助!

于 2014-01-18T11:20:54.150 回答
0

我像这样使用 Xcode 4 设置 Uncrustify:http: //blog.carbonfive.com/2011/03/10/code-formatting-in-xcode-4/

你能解释一下你试图做什么,你期望会发生什么,以及它是如何失败的吗?

于 2011-05-11T16:13:21.377 回答
0

Download zip On Windows, download the latest version of Uncrustify here: https://sourceforge.net/projects/uncrustify/files/latest/download

Extract zip The program is a standalone exe, so just extract the downloaded uncrustify-...-win32.zip file anywhere. For this example, I'll use C:\Uncrustify. So, the uncrustify.exe would be in that directory.

Add directory to PATH System Environment Variable In Windows 7+: Type Winkey + env - Select "Edit the system environment variables"

On the Advanced tab, click the Environment Variables button at the bottom. In the System variables section at the bottom, click the Path variable, then click the Edit... button.

Click the New button, and type C:\Uncrustify, or the directory that you extracted uncrustify.exe to.

Important: Click OK to close the dialog boxes or your change will not save. Verify

In a CMD window, typing where uncrustify should return the path to the uncrustify.exe.

In my case it shows C:\Uncrustify\uncrustify.exe Close Atom and reopen it. Now you should be able to atom-beautify and it will use Uncrustify to format your selection

于 2019-01-05T07:47:07.853 回答