clit: Post tweets from stdin

[ bsd3, library, program, web ] [ Propose Tags ]

a Command Line Interface Tweeter


[Skip to Readme]

Modules

[Last Documentation]

  • Web
    • Web.Tweet
      • Web.Tweet.Exec

Downloads

Maintainer's Corner

Package maintainers

  • No current members of group

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.1.0, 0.1.1.1, 0.1.1.2, 0.2.0.0, 0.2.0.1, 0.2.0.2, 0.2.2.2, 0.2.2.3, 0.2.2.4, 0.2.2.5, 0.2.2.6, 0.2.3.0, 0.2.3.1, 0.3.0.1, 0.3.0.2, 0.3.0.3, 0.3.1.0, 0.3.2.0, 0.4.0.0, 0.4.0.1, 0.4.0.2, 0.4.0.3, 0.4.0.4, 0.4.0.5, 0.4.0.6
Dependencies aeson (>=1.0.2.1 && <1.1), authenticate-oauth (>=1.6 && <1.7), base (>=4.9.1.0 && <4.10), bytestring (>=0.10.8.1 && <0.11), clit (>=0.2.3.1 && <0.3), data-default (>=0.7.1.1 && <0.8), http-client (>=0.5.6.1 && <0.6), http-client-tls (>=0.3.4 && <0.4), http-types (>=0.9.1 && <0.10), lens (>=4.15.1 && <4.16), optparse-applicative (>=0.13.1.0 && <0.14), split (>=0.2.3.1 && <0.3), text (>=1.2.2.1 && <1.3) [details]
License BSD-3-Clause
Copyright 2016 Vanessa McHale
Author Vanessa McHale
Maintainer tmchale@wisc.edu
Category Web
Home page https://github.com/vmchale/command-line-tweeter#readme
Source repo head: git clone https://github.com/vmchale/command-line-tweeter
Uploaded by vmchale at 2017-03-04T07:07:00Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables tweet
Downloads 17349 total (57 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2017-03-04 [all 3 reports]

Readme for clit-0.2.3.1

[back to package description]

Command Line Interface Tweeter

Config

Generate a token to authorize access to your twitter account by following the guide here

Then place your API keys and OAuth tokens in a file .cred, separated by a line break:

api-key: API_KEY_HERE
api-sec: API_SECRET_HERE
tok: OAUTH_TOKEN_HERE
tok-sec: TOKEN_SECRET_HERE

Installation

Install haskell stack; on unix systems this is as simple as

wget -qO- https://get.haskellstack.org/ | sh

Then type stack install in the directory and it will generate an executable called tweet, which is what we want.

Use

To tweet from stderr, run a command that pipes stderr to stdin, i.e.

YOUR_BUILD_COMMAND 2>&1 >/dev/null | tweet

The tweet executable reads from stdIn as its only behavior, but you can view the options (replies, number of tweets to thread, etc.) with

tweet --help

This script powers the twitter account @my_build_errors for instance. There's an example bash script for in bash/example

Completions

The directory bash/ has a mkCompletions script to allow command completions for your convenice.

Library

A haskell package is included. It's fairly easy to use once you have the credentials set up, with two main functions: thread and basicTweet: the first for threading your own tweets or replying to someone else's and the second for just tweeting.

Finer details

The function tweetData will tweet an object of type Tweet. Its use is pretty self-explanatory, but how to best form Tweets is not immediately obvious.

Tweet is an instance of Default so you can use def to get an empty tweet replying to nobody and not fetching extended user data. This is especially useful if you want to use lenses and avoid ugly record syntax, e.g.

set status "This is the new status field" $ def

will give you a Tweet with sensible defaults and the desired text.