在commandlinefu.com上搜索代码段的命令行工具

clf的Python项目详细描述


https://travis-ci.org/ncrocfer/clf.svg?branch=master

Commandlinefu.com是记录令人敬畏的命令行片段的地方。此工具允许您在终端中搜索和查看结果。

示例1

$ clf python server

  # python smtp server
  python -m smtpd -n -c DebuggingServer localhost:1025

  # Python version 3: Serve current directory tree at http://$HOSTNAME:8000/
  python -m http.server

  # Start a HTTP server which serves Python docs
  pydoc -p 8888& gnome-open http://localhost:8888

  # put current directory in LAN quickly
  python -m SimpleHTTPServer

  # An alternative to: python -m SimpleHTTPServer for Arch Linux
  python3 -m http.server

示例2

$ clf recursive line count

  # Recursive Line Count
  find ./ -not -type d | xargs wc -l | cut -c 1-8 | awk '{total += $1} END {print total}'# Recursive Line Count
  find * -type f -not -name ".*"| xargs wc -l

  # Get Total Line Count Of All Files In Subdirectory (Recursive)
  find . -type f -name "*.*" -exec cat {} > totalLines 2> /dev/null \;&& wc -l totalLines && rm totalLines

  # Recursive Line Count
  wc -l `find . -name *.php`

安装

该工具与python 2和python 3一起工作。它可以用pip安装:

pip install clf

用法

Command line tool to search snippets on Commandlinefu.com

Usage:
  clf --browse [options]
  clf <command> [options]
  clf <keyword> <keyword>... [options]

Options:
  -h, --help     Show this help.
  -v, --version  Show version.
  -c, --color    Enable colorized output.
  -b, --browse   Browse the Commandlinefu.com archive.
  --order=ORDER  The order output (votes|date) [default: votes].
  --proxy=PROXY  The proxy used to perform requests.

Examples:
  clf tar
  clf python server
  clf tar --proxy=http://127.0.0.1:8080
  clf --browse --order=date

注释

  • 默认情况下,可以设置CLF U COLOR环境变量以启用着色输出。
  • 您可以导入clf模块并在自己的脚本中使用它:
>>> from clf import Clf
>>> c = Clf()
>>> for cmd in c.browse():
>>>     print(cmd.summary)
>>>     print(cmd.command)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
google chrome我在哪里可以下载Mac OSX Lion的Java 6?   java管道化hadoop映射减少作业   java避免在使用jsoup解析html时删除空格和换行符   java将arrayList中的元素相互比较   如何创建一个计算一组数字之和的程序(Java)?   java JavaFX 8 JVM在退出后保留   升华文本3升华文本3 Java交互控制台?   JAVAutil。扫描仪和维基百科   java Android在RecyclerView中更新TextClock的时间格式(12/24小时格式)   java集合,如果达到限制,则可以在添加新项之前删除旧项   hex Java将十六进制转换为带符号的8位代码   java如何使用SQL中其他列的数据?   java如何确保返回指定类型的列表?   列出如何在java中声明匿名arraylist?   在JavaSpringBoot中使用RESTXML文件   使用Java在ColdFusion中计算HMACSHA256摘要的加密