Artistic Style的安装 Mac/Linux
本文目录
官方网址:http://astyle.sourceforge.net
Artistic Style
简称Astyle
,某种程度上是目前最好用的代码整理工具, 很多工具其实都是在Astyle
的基础上进行改进开发的.
除了windows
系统下有二进制文件外,其他系统均需要先下载源代码,然后编译安装。
以macOS
系统为例,简单说一下安装的过程,Linux
下也是类似的。
1. 源码下载
地址:https://sourceforge.net/projects/astyle/files/
点击下载。
2. 安装
在下载的文件所在的目录打开终端。
2.1. 解压
tar zxvf astyle_3.1_macos.tar.gz
解压结果:
macOS
上直接双击压缩包,自动解压到当前目录。
2.2. 编译安装
官网教程:http://astyle.sourceforge.net/install.html
-
图1
-
图2
终端执行命令:
cd astyle/build/mac
make
- 执行后的结果:
zzh@zzhdeMBP mac % ls
Makefile bin obj
zzh@zzhdeMBP mac % ls ./bin
AStyle
zzh@zzhdeMBP mac % AStyle
zsh: command not found: AStyle
zzh@zzhdeMBP mac %
- 配置PATH环境变量
- 获取程序的路径:
zzh@zzhdeMBP mac % cd bin
zzh@zzhdeMBP bin % pwd
/Users/zzh/Desktop/software-tools/astyle/build/mac/bin
zzh@zzhdeMBP bin %
- 修改终端配置文件:
echo 'export PATH="/Users/zzh/Desktop/software-tools/astyle/build/mac/bin:$PATH"' >> ~/.zshrc
-
说明:
根据自己使用的终端类型,将
export PATH="/Users/zzh/Desktop/software-tools/astyle/build/mac/bin:$PATH
添加到相应的终端配置文件中:- bash终端的配置文件:~/.bash_profile
- zsh终端的配置文件:~/.zshrc
其中的路径改为自己实际的路径。
-
让配置立即生效
zzh@zzhdeMBP bin % source ~/.zshrc
zzh@zzhdeMBP bin % astyle --version
Artistic Style Version 3.1
zzh@zzhdeMBP bin %