Skip to main content

No project description provided

Project description

Overview

dfmt is a Python command line tool that can reformat text, allowing you to go from:

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

to:

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

It can also be used to format paragraphs in comments and doc strings.

Input:

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

Output:

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

Usage

Send the text to stdin, and dfmt will write the results to stdout.

By default, text is wrapped at 80 characters. You can use the -w,–width option to set a different size.

As such, dfmt can be used in a number of text editors.

How it works

dfmt contains an hard-coded list of known prefixes.

It will start by splitting the input in “regions” that start with the same prefix.

Then it will use the textwrap module from the Python standard library to wrap each region while keeping the existing prefix.

It is also a bit smarted than vim’s gq commands, because it can keep leading * in Doxygen comments for instance.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dfmt-1.0.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dfmt-1.0.1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file dfmt-1.0.1.tar.gz.

File metadata

  • Download URL: dfmt-1.0.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.9 CPython/3.8.3 Linux/5.7.6-arch1-1

File hashes

Hashes for dfmt-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8bc0debb0fcb389e2c6a84680de61b21844f385e1c3e798fe08ca50b7fc71095
MD5 8a9da84b7da69eeb9a3c8d38dba0ec21
BLAKE2b-256 6a3cf7aa8bef5d9792d7bb3b056c854a70364c839c064280d76d6d52e42e9802

See more details on using hashes here.

File details

Details for the file dfmt-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: dfmt-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.9 CPython/3.8.3 Linux/5.7.6-arch1-1

File hashes

Hashes for dfmt-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f6e1a9acb866e4f9ebb7e6e6f58e907bb8449064c096cf3f7cadac848ceaa993
MD5 784da185dc13ea2e7a5930bb9a8dc456
BLAKE2b-256 7684bedf1e51046e0c1b1be2cf3e5e9bca2bb534d2088e1dc283991e4fac8b54

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page