bash でファイルとディレクトリにタブ補完を使用する場合、関連するディレクトリ レベルの補完の選択肢のみが表示されます。
$ ls /sys/class/mem/urandom/<TAB><TAB>
dev power/ subsystem/ uevent
ファイル システムと同様に、Python にはサブオブジェクトの階層があります。残念ながら、Python の REPL (つまり、通常はrlcompleter
モジュール) のタブ補完メカニズムを取得して、オブジェクトの完全な場所ではなく、可能な選択肢の関連部分のみを表示する方法を見つけられませんでした。
>>> import os
>>> os.path.supports_unicode_filenames.conjugate.__<TAB><TAB>
os.path.supports_unicode_filenames.conjugate.__call__( os.path.supports_unicode_filenames.conjugate.__module__
os.path.supports_unicode_filenames.conjugate.__class__( os.path.supports_unicode_filenames.conjugate.__name__
os.path.supports_unicode_filenames.conjugate.__delattr__( os.path.supports_unicode_filenames.conjugate.__ne__(
[...]
この動作はかなり面倒だと思うので、python の REPL のタブ補完メカニズムbash
をファイルやディレクトリのように動作させる方法はありますか?