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.

nyagosでbower searchを便利につかいたかった

Last updated at Posted at 2015-07-21

はじめに

bowerでパッケージ探すの面倒だな・・・

bower search

ってコマンドがあるらしいじゃないか!
もっと便利に使えないものか…せめてインストールしたい…

コード

alias{
    pbow = function (...)
        local str = ...
        local cmd = str[2]
        local result
        str = str[1]
        if str then
            result = nyagos.eval("bower search "..str.." | peco")
            if result then
                result = string.gsub(result, 'git:*[%a|%p]*[\r\n]*', '')
                result = string.gsub(result, 'Search results:[\r\n]*', '')
            end
            if cmd then
                nyagos.exec("bower install "..result.." "..cmd)
            else
                nyagos.exec("bower install "..result)
            end
        else
            print("pbow is bower search wrapper")
            print("pbow [search word] [cmd]")
            print("cmd:")
            print("    --save save dependencies bower.json")
            print("    --save-dev save devDependencies bower.json")
        end
    end
}

使い方

nyagos.dに上記を記述したpbow.luaを放り込むか、.nyagosに記述します。

C:>pbow [search] [cmd]

pecoでbower searchの結果を表示してくれます。
名前がうろ覚えでも、探せます便利!

#謝辞
nyagos
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?