LoginSignup
0
0

More than 5 years have passed since last update.

Docker のバージョン管理を Fish Shell で。。

Last updated at Posted at 2016-08-05

dvm

バージョン管理する意味はまだよくわかってないですが
dvm なるものがあるみたいなので使ってみました。

https://gyazo.com/54404558a00956dd0398fdafdf4fd47a

参考

install

curl -sL https://download.getcarina.com/dvm/latest/install.sh | sh

上を実行すると ~/.dvm/ 以下にファイルが入りました。

ls ~/.dvm
bash_completion  dvm-helper/  dvm.sh

fish に対応

fish を使っているので、fish用に書きなおしてくれている人がいないか探しました。

Set up dvm command for fish shell.

上記のコードを読みこむ際にエラーが出てしまったので、最低限の部分だけ抽出することにしました。

DVM_DIR 変数

これは決めうちで

~/.config/fish/config.fish
set -x DVM_DIR $HOME/.dvm

することにしました。

dvm function

dvm.fish

このファイルを ~/.config/fish/functions/ 以下に置いています。

補完

dvm_completion.fish

bash_completion を参考に、 dvm を今日入れた自分でもすぐ使いそうなものだけ、補完するようにしています。

complete -f -c dvm -n '__fish_dvm_using_command' -a "install uninstall use current ls ls-remote deactivate which"
complete -f -c dvm -n '__fish_dvm_using_command use' -a '(command ls $DVM_DIR/bin/docker)'

completions フォルダに置いたのですが読みこんでくれなかったのでとりあえず、無理やり読み込みました。

~/.config/fish/config.fish
source ~/.config/fish/completions/dvm_completion.fish

補足

dvm function の中で sed -r を使っているのですが

sed: illegal option -- r

みたいなエラーが出たら こちら を参考に gnu-sed を入れてみてください。

0
0
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
0
0