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


fish

fish とは。

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

prompt

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

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

テーマ

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

とすると

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

参考

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