4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

genymotion-pecoを使ってみようとして、ちょっと変更した

Posted at

クックパッドの以下のブログで紹介されていて、
genymotionをコマンドラインから起動させるようにしたもの。

仕組みとしては、

VBoxManage list vms | peco

これでvirtual boxの一覧の表示させて、pecoでいい感じに選択して、

/Applications/Genymotion.app/Contents/MacOS/player --vm-name "Google Galaxy Nexus - 4.3 - API 18 - 720x1280"

みたいな感じでコマンドラインから実行するというもの。


しかし、僕は普段zshを使ってるから?正規表現の部分が上手く動きませんでした。。。

なので、sourceコマンドで読み込むのではなくて、
~/binディレクトリに置いて動かす事ようにしました。

$ cd ~/bin
$ vim genymotion_peco
# !/bin/sh

if [ -z "$GENYMOTION_APP_HOME" ]; then
echo "GENYMOTION_APP_HOME is empty. Use '/Applications/Genymotion.app/' instead this time."
player="/Applications/Genymotion.app/Contents/MacOS/player"
else
player="$GENYMOTION_APP_HOME/Contents/MacOS/player"
fi

vm_name=`VBoxManage list vms | peco`
if [[ $vm_name =~ ^\"(.+)\".* ]] ; then
 name=${BASH_REMATCH[1]}
 echo "boot $name"
 $player --vm-name "$name" &
fi
$ chmod +x genymotion_peco

実行権限をつけるのを忘れずに。これでまた少し楽になったー

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?