Skip to main content

An unholy blend of grep, sed, and awk, with very specific features.

Project description

This is my text munging tool. There are many like it, but this one is mine.

linesieve is an unholy blend of grep, sed, and awk, with very specific features, born out of spite.

build codecov PyPI black

Features

  • line-oriented
  • section-oriented
    • show only matching sections
    • show the failing section
  • match/sub with the full power of re
  • chain filters into pipelines
  • colors!
  • TODO: specific filters

Examples

Get all options used by any git command

Note that some of the man pages contain multiple OPTIONS sections (e.g. ADVANCED OPTIONS).

export MANWIDTH=9999

function man-section {
    col -b | python3 -m linesieve -s '^[A-Z ()-]+$' show "$@"
}

man git \
| man-section COMMANDS match -o '^ +(git-\w+)' \
| cat - <( echo git ) \
| sort | uniq \
| xargs -n1 man \
| man-section OPTIONS match -o '^ +(-.*)' \
    sub -F -- '--[no-]' '--' \
    sub -F -- '--no-' '--' \
| sort -dfu

Output:

-/ <path>
-, --stdin
-0
...
-a, --all
-A, --all, --ignore-removal
-a, --annotate
...
--autosquash, --autosquash
--autostash, --autostash
-b
-b, --branch
...

TODO: Ant output

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

linesieve-1.0a5.tar.gz (15.5 kB view hashes)

Uploaded Source

Built Distribution

linesieve-1.0a5-py3-none-any.whl (11.1 kB view hashes)

Uploaded Python 3

Supported by

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