Frog - Androidのクラス名を即引き
開発者にとってAPIドキュメントは大事な存在です。その言語やプラットフォームに慣れたプログラマほど、APIドキュメントを頻繁に参照します。昔であれば書籍が使われてきましたが、最近ではオンラインを利用する方が検索もできますし、便利です。 今回はAndroid開発者のためのドキュメント即引きツール、Frogを紹介します。
Frogの使い方
FrogはRubygemsでインストールできます。インストール後はクラス名で検索できます。通常は前後一致です。
$ frog preferences
Enter the index of the docs you want. ex: Enter 1 if you wish to select the first option.
1: android.app.backup.SharedPreferencesBackupHelper
2: android.content.SharedPreferences
3: android.content.SharedPreferences.Editor
4: android.content.SharedPreferences.OnSharedPreferenceChangeListener
5: android.preference.PreferenceFragment.OnPreferenceStartFragmentCallback
6: android.preference.PreferenceScreen
7: android.support.v14.preference.PreferenceFragment.OnPreferenceStartFragmentCallback
8: android.support.v14.preference.PreferenceFragment.OnPreferenceStartScreenCallback
9: android.support.v4.content.SharedPreferencesCompat
10: android.support.v4.content.SharedPreferencesCompat.EditorCompat
11: android.support.v7.preference.PreferenceFragmentCompat.OnPreferenceStartFragmentCallback
12: android.support.v7.preference.PreferenceFragmentCompat.OnPreferenceStartScreenCallback
13: android.support.v7.preference.PreferenceScreen
14: java.util.prefs.AbstractPreferences
15: java.util.prefs.InvalidPreferencesFormatException
16: java.util.prefs.Preferences
17: java.util.prefs.PreferencesFactory
読みたい情報の番号を入力すると、そのページをブラウザで開きます。
-eオプションで正確に一致したクラス名だけを表示します。
$ frog -e Activity
Boom! Launching https://developer.android.com/reference/android/app/Activity.html
もし該当するクラス名がなかったらエラーが出ます。
$ frog -e Activity2
Sorry. It looks like we couldn't find what you were looking for
オプションです。
$ frog -h
Usage: droiddocs.rb [options] search_term
-e, --exact Search for the exact class
-h, --help Displays Help
Frogを使えばAndroidのクラス名で使い方が分からない場合にすぐに調べられるようになります。標準で提供されているクラスだけなのでサードパーティー製のライブラリについては調べられませんが、Androidの開発者サイトで一つ一つ調べるよりも簡単でしょう。
FrogはRuby製、MIT Licenseのオープンソース・ソフトウェアです。
anupcowkur/frog: Frog is a command line tool to help you quickly jump to the right Android doc.