LoginSignup
4
4

More than 5 years have passed since last update.

起動時にGoogleの急上昇ワードを教えてくれるfishのテーマ

Last updated at Posted at 2015-12-03

:fish: fish

fish とは。

fish(friendly interactive shell)とはUNIXにおけるシェルの一つである

prompt

以下のようにfish_promptなど特定の名前の関数を上書きするとテーマが変わります。

134E92EB-9647-4995-965C-72AED19AD4CE.png

:fishing_pole_and_fish: oh-my-fish

oh-my-fishは fish shell のフレームワークで

curl -L https://github.com/oh-my-fish/oh-my-fish/raw/master/bin/install | fish

のように
簡単にインストールすることができます。

また omf コマンドが使えるようになり、install でプラグインやテーマのインストール、theme でテーマの設定などができます。

> omf help                                                                                 
      $ omf [command] [arguments]

      Usage:
        omf install [<name>|<url>]
        omf theme [<name>]
        omf remove [<name>]
        omf update
        omf help [<command>]

      Commands:
        list      List local packages.
        describe  Get information about what packages do.
        install   Install one or more packages.
        theme     List / Use themes.
        remove    Remove a theme or package.
        update    Update Oh My Fish.
        cd        Change directory to plugin/theme directory.
        new       Create a new package from a template.
        submit    Submit a package to the registry.
        destroy   Uninstall Oh My Fish.
        doctor    Troubleshoot Oh My Fish.
        help      Shows help about a specific action.

      Options:
        --help     Display this help.
        --version  Display version.

      For more information visit → git.io/oh-my-fish

:computer: テーマ

omf で最初から使えるテーマもたくさんあり、その中からでも気に入るのが見つかると思いますが

omf new theme <theme_name>

上記のように new コマンドで雛形を作ることができます。
~/.config/omf/themes/<theme_name> に以下のようなファイルが作られます。

> ls
LICENSE                fish_greeting.fish     fish_right_prompt.fish
README.md              fish_prompt.fish       fish_title.fish

起動時

ここで fish_greeting.fish に手を加えるとシェル起動時のメッセージを編集することができます。

例えば

fish_greeting.fish
function fish_greeting -d "what's up, fish?"
  set_color $fish_color_autosuggestion[1]
  uname -npsr
  uptime
  echo "Google hourly hot trends"
  set_color normal
  curl -s -S https://trends.google.co.jp/trends/hottrends/atom/hourly | grep "<li>" | sed -e 's/<[^>]*>//g'
end

とすると

fish greets trends

のようにターミナル起動時に急上昇ワードを表示してくれました。

:construction_worker: 参考

Googleトレンドの取得は以下を参考にしました。

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