102 lines
2.9 KiB
Markdown
102 lines
2.9 KiB
Markdown
forthlift — post sequences of texts on social media
|
|
===================================================
|
|
|
|
Forthlift's primary use case is a command line application to post sequences of
|
|
text items on social media. You first prepare your thread in your text editor,
|
|
then call forthlift, and everything is posted at once.
|
|
|
|
As side effect, fothlift became a more generic tool, that can process text
|
|
streams, format them, assemble their atomic units in anothers, and then send
|
|
them elsewhere. It is thus designed to ease automation and integration with
|
|
existing tools, and has an Unix-like text-and-pipes philosophy.
|
|
|
|
## Examples
|
|
|
|
### Select in Vim, post on Mastodon
|
|
|
|
Forthlift makes it easy to post "chained" Mastodon toots
|
|
(that answer to each others) from your text editor.
|
|
Just send the selected text to its standard input, selecting the
|
|
twitter API, and voilà.
|
|
|
|
Using Vim, you can toot the visually-selected lines (each line making a toot)
|
|
with:
|
|
```vim
|
|
:'<,'>w !forthlift --lift mastodon
|
|
```
|
|
|
|
### Prepare toots in a file, post on Mastodon
|
|
|
|
Let's say that you prepared a text file of the form:
|
|
|
|
```
|
|
This is a multi-lines...
|
|
|
|
... toot!
|
|
--
|
|
And here is an answeer to the previous toot.
|
|
(With two lines as well.)
|
|
--
|
|
And a final toot.
|
|
```
|
|
|
|
You would want the toots to show a counter, managing the expectations of your
|
|
reader.
|
|
|
|
You can post it right away with:
|
|
```sh
|
|
cat my_file.txt | forthlift --consume "sections:--,skip" --format counter -l mastodon
|
|
```
|
|
|
|
### Manage long threads from Markdown
|
|
|
|
Let's say you want to post the sections of this README as a sequence of toots,
|
|
with a hashtag that indicates it's gona be long.
|
|
And you would want to double-check what it would do first. You can send the
|
|
items on the standard output, like:
|
|
|
|
```sh
|
|
forthlift -s filename:README.md -c sections -f suffix:#longThread -f panel -l stdout
|
|
```
|
|
|
|
|
|
### Full-featured file-to-Mastodon pipeline
|
|
|
|
```sh
|
|
# Define a shortcut
|
|
mastopost() { forthlift -s "filename:$1" -c sections:^#,skip -f skip -f counter -f suffix:#longThread -l mastodon; }
|
|
# Call it with:
|
|
mastopost my_file.txt
|
|
```
|
|
|
|
|
|
## DESCRIPTION
|
|
|
|
### A generic tool
|
|
|
|
Generally speaking, Forthlift is a Unix-like command that operate a sequence of
|
|
pre-programmed chained actions on its text input.
|
|
|
|
Forthlift has four action operators classes, one for each step of the processing:
|
|
|
|
1. `stream`, indicating from where to get the input data.
|
|
2. `consume`, telling *how* to parse the data from the input stream.
|
|
3. `format`, for manipulating the content itself.
|
|
4. `lift`, defining where to send the final items.
|
|
|
|
Only one `consume` operator can be passed, but any number of `stream`, `format`,
|
|
and `lift` operators can be combined.
|
|
To apply several operators of the same class, the user must pass the same flag
|
|
several time. For instance:
|
|
|
|
```sh
|
|
# Applies strip, then skip, then counter on the consumed lines.
|
|
forthlift --format strip --format skip --format counter
|
|
```
|
|
|
|
Most of the time, the order of the operators matters.
|
|
|
|
|
|
## SYNOPSIS
|
|
|
|
{{FORTHLIFT_HELP}}
|