a command line utility that transforms stdin to stdout by sending user defined chunks through the specified filter https://git.lenzplace.org/lenzj/chuf
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Jason T. Lenz 17a18a70ff Fix automated version pull from git 5 months ago
doc Initial commit 1 year ago
template Further Makefile cleanup 1 year ago
tests Initial commit 1 year ago
.gitignore Initial commit 1 year ago
LICENSE Initial commit 1 year ago
Makefile Fix automated version pull from git 5 months ago
README.md Update contact info 1 year ago
go.mod Initial commit 1 year ago
go.sum Initial commit 1 year ago
main.go Initial commit 1 year ago

README.md

chuf

chuf is a command line utility that transforms stdin to stdout by sending predefined chunks through the specified FILTER. A chunk is defined by a BEGIN and END byte sequence within the stream. Anything not within a chunk is passed along unmodified.

Synopsis

chuf BEGIN END FILTER

BEGIN : Byte sequence designating beginning of chunk

END : Byte sequence designating end of chunk

FILTER : Command filter to transform chunk. A multiple parameter command filter must be enclosed in quotes.

Example 1 - Simple text markup using unix "tr" command.

$ echo "the quick {U}brown fox{R} jumped over the lazy dog" | \\
chuf {U} {R} "tr [:lower:] [:upper:]"
the quick BROWN FOX jumped over the lazy dog

Example 2 - Expand markdown within html document.

$ cat example.mdhtml
<!DOCTYPE html>
<html>
    <head>
        <title>Example</title>
    </head>
    <body>
<md>
# Markdown table example

| Name   | Hobby        | Age   |
| ------ |:------------:| -----:|
| Bob    | golfing      |    18 |
| Monica | programming  |    32 |
</md>
    </body>
</html>
$ chuf '<md>' '</md>' markdown < example.mdhtml
<!DOCTYPE html>
<html>
    <head>
        <title>Example</title>
    </head>
    <body>
<h1>Markdown table example</h1>
<table>
<thead>
<tr>
<th> Name   </th>
<th style="text-align:center;"> Hobby        </th>
<th style="text-align:right;"> Age   </th>
</tr>
</thead>
<tbody>
<tr>
<td> Bob    </td>
<td style="text-align:center;"> golfing      </td>
<td style="text-align:right;">    18 </td>
</tr>
<tr>
<td> Monica </td>
<td style="text-align:center;"> programming  </td>
<td style="text-align:right;">    32 </td>
</tr>
</tbody>
</table>
    </body>
</html>

Compiling from source

Dependencies

  • Go compiler (v1.12 or later).
  • Go package chunkio
  • Go package testcli to run tests.
  • scdoc utility to generate the man page. Only needed if changes to man page source (chuf.1.scd) are made.
  • pgot utility to process files in the templates sub folder. Only needed if changes to README.md, LICENCE, Makefile etc. are needed.

Installing

$ make
# make install

Running the tests

$ make check

Contributing

If you have a bugfix, update, issue or feature enhancement the best way to reach me is by following the instructions in the link below. Thank you!

https://blog.lenzplace.org/contact

Versioning

I follow the SemVer strategy for versioning. The latest version is listed in the releases section.

License

This project is licensed under a BSD two clause license - see the LICENSE file for details.