简体   繁体   English

如何安装uncrustify?

[英]How do I install uncrustify?

How do I install uncrustify ? 如何安装uncrustify I followed the instruction to install uncrustify but when I run it, it does not work. 我按照说明安装了uncrustify,但是当我运行它时,它不起作用。 Can anyone give me some help installing this tool? 谁能给我一些安装此工具的帮助? I want to run it on objective-c code in xcode 4. Thanks in adavance 我想在xcode 4中的Objective-C代码上运行它。

On OS X Mavericks 10.9.1 : 在OS X Mavericks 10.9.1上:

1- to install brew, open a terminal windows and type : 1-安装brew,打开终端窗口,然后输入:

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

It will ask you to download some other files, answer OK for all (for more information see : http://brew.sh/index_fr.html ). 它将要求您下载其他文件,对所有文件都回答OK(有关更多信息,请参见: http : //brew.sh/index_fr.html )。

2 - to install uncrusify, open a terminal windows an type : 2-要安装uncrusify,请打开终端窗口,键入:

brew install uncrustify

3 - to make your code beautiful, download BBUncrustifyPlugin-Xcode available at https://github.com/benoitsan/BBUncrustifyPlugin-Xcode 3-为了使您的代码漂亮,请从以下网址下载BBUncrustifyPlugin-Xcode: https://github.com/benoitsan/BBUncrustifyPlugin-Xcode

You will just have to : 您只需要:

  • compile the project 编译项目
  • copy the file uncrusify.cfg in your home directory 将文件uncrusify.cfg复制到主目录中
  • restart Xcode. 重新启动Xcode。

NB : With BBUncrustifyPlugin, you don't need to use Automator. 注意:使用BBUncrustifyPlugin,您不需要使用Automator。

4 - After restarting Xcode, use the menu Edit > Uncrustify Selected Files to uncrustify the selected items in the project navigator. 4-重新启动Xcode后,使用菜单“编辑”(Edit)>“取消对选定的文件的解密”(Uncrustify Selected Files)对项目导航器中的选定项目进行取消解密。

Your code is now beautiful! 您的代码现在很漂亮! That's magic! 太神奇了!

post-scriptum : You can easily change your uncrusify configuration file by using : 脚本后:您可以使用以下命令轻松更改未加密的配置文件:

I hope that this will help! 我希望这会有所帮助!

Download zip On Windows, download the latest version of Uncrustify here: https://sourceforge.net/projects/uncrustify/files/latest/download 下载zip在Windows上,请在此处下载最新版本的Uncrustify: 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. 解压缩zip该程序是一个独立的exe,因此只需将下载的uncrustify -...- win32.zip文件解压缩到任何位置。 For this example, I'll use C:\\Uncrustify. 对于此示例,我将使用C:\\ Uncrustify。 So, the uncrustify.exe would be in that directory. 因此,uncrustify.exe将在该目录中。

Add directory to PATH System Environment Variable In Windows 7+: Type Winkey + env - Select "Edit the system environment variables" 在Windows 7+中将目录添加到PATH系统环境变量:键入Winkey + env-选择“编辑系统环境变量”

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. 单击“新建”按钮,然后键入C:\\ Uncrustify或将uncrustify.exe提取到的目录。

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. 在CMD窗口中,键入uncrustify的位置应将路径返回uncrustify.exe。

In my case it shows C:\\Uncrustify\\uncrustify.exe Close Atom and reopen it. 就我而言,它显示C:\\ Uncrustify \\ uncrustify.exe关闭Atom并重新打开它。 Now you should be able to atom-beautify and it will use Uncrustify to format your selection 现在您应该能够进行原子美化,它将使用Uncrustify格式化选择

I setup Uncrustify with Xcode 4 like so: http://blog.carbonfive.com/2011/03/10/code-formatting-in-xcode-4/ 我像这样用Xcode 4设置了Uncrustify: http : //blog.carbonfive.com/2011/03/10/code-formatting-in-xcode-4/

Can you explain what you tried to do, what you expected to happen, and how it didn't work? 您能解释一下您尝试做的事情,预期发生的事情以及它是如何工作的吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM