我正在编写一个自举脚本来自动化新开发人员的Mac计算机的某些设置。到目前为止,我已经能够使用brew cask
从命令行安装SP:
brew cask install sequel-pro
是否有可能创建SP"收藏夹"从命令行,以便,例如,新开发人员已经在他/她的指尖已经有一个连接参数到本地Vagrant框?
答案 0 :(得分:0)
Sequel Pro将其收藏夹存储在~/Library/Application Support/Sequel Pro/Data/Favorites.plist
,密码存储在钥匙串中。所以我不得不做两件事:
通过查看当前Favorites.plist
的内容,我想出了这个基本的启动文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Favorites Root</key>
<dict>
<key>Children</key>
<array>
<dict>
<key>database</key>
<string>my_db_name</string>
<key>host</key>
<string>127.0.0.1</string>
<key>id</key>
<integer>-4414284772604805500</integer>
<key>name</key>
<string>homestead</string>
<key>port</key>
<string>33060</string>
<key>socket</key>
<string></string>
<key>sshHost</key>
<string></string>
<key>sshKeyLocation</key>
<string></string>
<key>sshKeyLocationEnabled</key>
<integer>0</integer>
<key>sshPort</key>
<string></string>
<key>sshUser</key>
<string></string>
<key>sslCACertFileLocation</key>
<string></string>
<key>sslCACertFileLocationEnabled</key>
<integer>0</integer>
<key>sslCertificateFileLocation</key>
<string></string>
<key>sslCertificateFileLocationEnabled</key>
<integer>0</integer>
<key>sslKeyFileLocation</key>
<string></string>
<key>sslKeyFileLocationEnabled</key>
<integer>0</integer>
<key>type</key>
<integer>0</integer>
<key>useSSL</key>
<integer>0</integer>
<key>user</key>
<string>homestead</string>
</dict>
</array>
<key>IsExpanded</key>
<true/>
<key>Name</key>
<string>FAVORITES</string>
</dict>
</dict>
</plist>
我将此Favorites.plist
保存在与我的引导脚本相同的目录中(如原始问题中所述),并将这3行添加到脚本中:
mkdir -p ~/Library/Application\ Support/Sequel\ Pro/Data/
cp -f Favorites.plist ~/Library/Application\ Support/Sequel\ Pro/Data/
security add-generic-password -U -T "/Applications/Sequel Pro.app" -s "Sequel Pro : homestead (-4414284772604805500)" -a homestead@127.0.0.1/my_db_name -w secret
Favorites.plist
(名称,数据库,ID等)中的元素对齐security
command. 中提琴!