howdoi-通过命令行快速得到编程答案的python工具

howdoi是通过命令行快速得到编程答案的python工具。

您是否会不断通过搜索引擎以了解如何执行基本的编程任务?假设您想知道如何在bash中格式化日期。当您只需要停留在控制台中并询问howdoi时,就不需要打开浏览器去搜索结果了(可能会分散注意力)。例如:

$ howdoi format date bash> DATE=`date +%Y-%m-%d`

示例

$ howdoi print stack trace python> import traceback>> try:>     1/0> except:>     print '>>> traceback <<<'>     traceback.print_exc()>     print '>>> end of traceback <<<'> traceback.print_exc()$ howdoi convert mp4 to animated gif> video=/path/to/video.avi> outdir=/path/to/output.gif> mplayer "$video" >         -ao null >         -ss "00:01:00" \  # starting point>         -endpos 10 \ # duration in second>         -vo gif89a:fps=13:output=$outdir >         -vf scale=240:180$ howdoi create tar archive> tar -cf backup.tar --exclude "www/subf3" www

安装

pip install howdoi或者您也可以直接在网盘下载howdoi的源代码。

用法

usage: howdoi.py [-h] [-p POS] [-a] [-l] [-c] [-j] [-n NUM_ANSWERS] [-C] [-v] [-e ENGINE] [--save] [--view] [--remove] [--empty] QUERY [QUERY ...]instant coding answers via the command linepositional arguments:  QUERY                 the question to answeroptional arguments:  -h, --help            show this help message and exit  -p POS, --pos POS     select answer in specified position (default: 1)  -a, --all             display the full text of the answer  -l, --link            display only the answer link  -c, --color           enable colorized output  -j, --json-output     return answers in raw json format, to pretty print try 'howdoi pretty print json command line'  -n NUM_ANSWERS, --num-answers NUM_ANSWERS                        number of answers to return  -C, --clear-cache     clear the cache  -v, --version         displays the current version of howdoi  -e ENGINE, --engine ENGINE  change search engine for this query only. Currently supported engines: google (default), bing, duckduckgo.  --save                stash a howdoi answer  --view                view your stash  --remove              remove an entry in your stash  --empty               empty your stash
(0)

相关推荐