在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第三方库


热门话题
java如何调试Quarkus/SmallRye客户端请求   安卓找不到R.layout。主要活动中的主要活动。JAVA   java使复制的图像都独立旋转   java需要一双新眼睛来找出为什么我的四边形没有被着色   java记录方法调用,包括参数,以便在程序执行后可以执行这些参数   JavaSpringMVC+AngularJS向数据库添加多个条目   java删除具有重复字段值的entrySet对象   为什么我们无法解密使用ECB/PKCS1使用RSA加密在python中加密的java数据   并行处理java。util。同时发生的拒绝执行异常,等待终止   java/groovy使用指定的值从列表中收集元素   java在spring webproject中使用CSS和JS   在以下任何来源中都找不到java插件[id:'com.gradle.enterprise',版本:'3.2']   在java中知道时间是否已经过去的日期   java如何在JavaFX中为两个节点之间的2D曲线箭头设置动画   JAVAsql。SQLException:第1行“IdentitCAT”列的整数值“Guitare”不正确   如何获取使用数组删除的元素详细信息。使用couchbase Java SDK的asList(remove())?   ssl得到了JAVA例外:JAVA。安全spec.InvalidKeySpecException:未知的KeySpec类型   多线程Java扫描器输入在单独的线程中