前段時間咱們分享了explainshell.com 一個命令行解釋的網站,它會分析命令的幫助文檔,根據你想查詢的命令參數來抽取對應的解釋,而後很是清晰地顯示出來。python
然而,有時咱們會有本地查詢的需求,好比:git
本文將介紹如何在本地架設explainshell服務。放心,這很容易。github
首先咱們須要將explainshell的git倉庫克隆到本地:mongodb
git clone https://github.com/idank/explainshell.git
而後是安裝須要的依賴。首先要安裝mongodb,在Debian/Ubuntu下能夠經過以下命令安裝:shell
sudo apt-get install mongodb
而後是python的一些庫,能夠自動安裝:segmentfault
cd explainshell pip install -r requirements.txt
以後是用mongodb加載分類數據:瀏覽器
mongorestore dump/explainshell && mongorestore -d explainshell_tests dump/explainshell
好了,差很少完成了,運行下測試,確保沒出什麼問題:網絡
make tests
測試O.K.以後,咱們添加下man page。倉庫裏自帶的man page屈指可數,僅供測試之用。咱們須要將本機上的man page添加過來。測試
rm -r manpages/1 manpages/2 ln -s /usr/share/man/man1 manpages/1 ln -s /usr/share/man/man8 manpages/8 python explainshell/manager.py --log info echo
注意咱們使用了軟連接,這樣不會佔用額外的磁盤空間,最重要的是,咱們的操做系統更新軟件以後咱們不須要重複添加。網站
好了,如今只需啓動服務就能夠了
make serve
如今就能夠在本地使用explainshell 啦!只需在瀏覽器裏訪問 http://127.0.0.1:5000/