The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
Coverage Status

NAME

txtnix - Client for twtxt, the minimalist microblogging service for hackers

SYNOPSIS

  $ txtnix --help

    Command:
    tweet       Append a new tweet to your twtxt file.
    timeline    Retrieve your personal timeline.
    view        Show feed of given source.
    follow      Add a new source to your followings.
    unfollow    Remove an existing source from your followings.
    following   Return the list of sources you're following.
    config      Get or set config item.

    Options:
      --help      Print a help message and exit.
      --config    Specify a custom config file location.

   $ txtnix follow bob http://example.com/twtxt.txt
   $ txtnix tweet 'Hello twtxt world'
   $ txtnix timeline

DESCRIPTION

txtnix is a client for the decentralised, minimalist microblogging service for hackers https://github.com/buckket/twtxt.

Instead of signing up at a closed and/or regulated microblogging platform, getting your status updates out with twtxt is as easy as putting them in a publicly accessible text file. The URL pointing to this file is your identity, your account. twtxt then tracks these text files, like a feedreader, and builds your unique timeline out of them, depending on which files you track. The format is simple, human readable, and integrates well with UNIX command line utilities.

All subcommand of txtnix provides extensive help, so don't hesitate to call them with the --help option.

CONFIGURATION FILE

twtxt uses a simple INI-like configuration file. It checks ~/.config/twtxt/config for its configuration, but you can overwrite it with the command line switch --config.

Here's an example conf file, showing every currently supported option:

  [twtxt]
  nick = bob
  twtfile = ~/twtxt.txt
  twturl = http://example.org/twtxt.txt
  check_following = 0
  use_pager = 0
  use_cache = 1
  disclose_identity = 0
  limit_timeline = 20
  timeout = 5
  sorting = descending
  pre_tweet_hook  = "scp buckket@example.org:~/public_html/twtxt.txt {twtfile}"
  post_tweet_hook = "scp {twtfile} buckket@example.org:~/public_html/twtxt.txt"

  [following]
  alice = https://example.org/alice.txt
  charlie = https://example.org/charlie.txt

twtxt

nick

Your nick, will be displayed in your timeline, expanded in your tweets and send in your user agent string if you set disclose_identity to true. Defaults to your local username.

twtfile

Path to your local twtxt file. Defaults to ~/twtxt.txt.

twturl

URL to your public twtxt file. This is only needed in case you decide to disclose your identity.

use_pager

Use a pager (less) to display your timeline. Defaults to false.

use_cache

Cache remote twtxt files locally. This defaults to true as their usually is no reason not to do this. Every URL is checked with a If-Modified-Since header, so you still get always the most up-to-date timeline.

disclose_identity

Include nick and twturl in twtxt's user-agent. To respect your privacy this feature is disabled by default. But you may enable it to let other users discover that you follow them.

limit_timeline

Limit amount of tweets shown in your timeline. Defaults to 20.

timeout

Time a http request is allowed to take. Defaults to 5 seconds.

rewrite_urls

Rewrite urls your following depending on their http response code. Currently only 301 (moved permanently) are rewritten, but this may change in the future. Defaults to true. You get a warning if a url is rewritten.

embed_names

txtnix expands the local names in your tweets to their urls. So @bob becomes @<http://example.com/twtxt.txt>. With embed names you can also share your local nickname with your followers. If this is set to true mentions will be rewritten to @<bob http://example.com/twtxt.txt>. Defaults to true.

sorting

Order in which to sort the timeline. Can be either descending or ascending. Dedault to descending, so the newest tweets are on the top of the timeline.

time_format

Format to convert timestamp to a date in your timeline. Defaults to %F %H:%M.

pre_tweet_hook

Command to be executed before tweeting.

post_tweet_hook

Command to be executed after tweeting.

followings

This section holds all your followings as nick, URL pairs. You can edit this section manually or use the follow/unfollow commands of twtxt for greater comfort.

Hooks

pre_tweet_hook and post_tweet_hook are very useful if you want to push your twtxt file to a remote server. The following examples are just some ideas, basically the sky is the limit.

Transmit the the latest tweet via curl to an http endpoint:

  post_tweet_hook = "tail -1 {twtfile} | curl -s -d @- -d 'name=foo' -d 'password=bar' http://example.com/feeds"

Publish your twtfile on aws s3:

  post_tweet_hook = "aws s3 cp {twtfile} s3://mybucket.org/twtxt.txt --cache-control 'max-age=60,public'"

Update your git hosted twtfile before tweeting and push it afterwards:

  pre_tweet_hook = "cd ~/git/website && git pull --rebase --prune"
  post_tweet_hook = "cd ~/git/website && git commit -m tweet twtxt.txt && git push"

COPYRIGHT AND LICENSE

Copyright 2015 Mario Domgoergen <mario@domgoergen.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.