Skip to main content

未提供项目描述

项目描述

https://img.shields.io/pypi/v/dfmt.svg

概述

dfmt 是一个 Python 命令行工具,可以重新格式化文本,允许您从:

this is a pretty big sentence with lots of words that takes a lot of horizontal space

至:

this is a pretty big sentence with lots
of words that takes a lot of horizontal
space

它还可用于格式化注释和文档字符串中的段落。

输入:

/**
 * This is a very long line in a Doxygen comment that takes a lot of space
 */

输出:

/**
 * This is a very long line in a
 * Doxygen comment that takes a lot of
 * space
 */

安装

推荐的方式是使用pipx安装dfmt。如果您知道自己在做什么,也可以直接使用pip 。

用法

将文本发送到标准输入,dfmt 会将结果写入标准输出。

默认情况下,文本以 80 个字符换行。您可以使用 -w,–width选项设置不同的大小。

因此,dfmt可以在许多文本编辑器中使用。

这个怎么运作

dfmt 包含已知前缀的硬编码列表。

它将首先将输入拆分为以相同前缀开头的“区域”。

然后它将使用 Python 标准库中的textwrap模块来包装每个区域,同时保留现有的前缀。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

dfmt-1.2.0.tar.gz (2.8 kB 查看哈希

已上传 source

内置分布

dfmt-1.2.0-py3-none-any.whl (2.8 kB 查看哈希

已上传 py3