11月3号参加了SpringOne大会,看到Josh Long使用uao命令打开demo项目非常方便,就从网上找了一下怎么安装uao命令。
目的:使用自定的命令完成一些定制的工作,uao用于打开spring initializer 的压缩包项目,并直接解压以及使用IDE打开
实现原理:
- 安装w3m
brew install w3m
- 安装xdg-open
brew install libxslt xmlto
export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"
git clone git://anongit.freedesktop.org/xdg/xdg-utils
cd xdg-utils
./configure --prefix=/usr/local/
make
make install
- 设置xml默认打开方式为Idea,可以参考下面链接,但要选择默认程序为Idea
https://www.jianshu.com/p/b612a4737668
- 编辑uao脚本,放入/usr/local/bin
#!/bin/sh
file=$1
dir=${file%%.*}
unzip $file
if [ -f "$dir/pom.xml" ]
then
proj="$dir/pom.xml"
elif [ -f "$dir/build.gradle" ]
then
proj="$dir/build.gradle"
fi
xdg-open $proj
- 运行uao
uao springonedemo.zip
网友评论