Git Product home page Git Product logo

twt's Introduction

twt - A simple CLI Twitter client

twt is a Twitter client designed to be as easy as possible to be used from CLI. You'll never have to switch from your preferred console to the browser and check latest tweets anymore.

Installation

You need a working Ruby environment. On Linux and OS X, the default ruby 1.8.7 is OK, and it also work with Ruby 1.9.x

Then you have to install twt via rubygems:

% sudo gem install twt

This will also install a few dependencies.

If you are on Windows, well, just try and let me know if it works.

Since version 0.2.1, twt checks online for new version availability. If found, it remembers you to upgrade your gem.

Usage

A short guide appears if you type:

% twt

Login

This version relies on OAuth for authentication. This means that the very first time you try to do something, twt will launch your browser and ask Twitter for connection. You have to confirm the request (within the browser), copy the PIN it gives you back, and past the PIN after the prompt that twt is presenting you. Since now, you are connected and each subsequent command would not require additional authentication, until you would logout.

Logout

If you want to remove your credentials, just type:

% twt logout

Read friends or user timelines

To read you friends timeline, your own timeline, and the tweets mentioning you, simply issue:

% twt friends
% twt user
% twt mention

You can also get a specific user's timeline (in the example, mine):

% twt user p4010

Post a message

To post a new message, issue:

% twt post "Ho! This is a nice new message from twt!"

Note that twt will automatically cut your message down to 137 characters and add tree points at the end ("...") if your original message would result longer than 140 characters. You will be noticed about this shortening operation.

NEW in ver. 0.2! If you are not connected to the Internet when you post a message, the message will be queued. You can view and manipulate your queued messages with the command:

% twt queue
0. test1
1. test2
2. test3
% twt dequeue 0 2           # deletes messages 0 and 2 from the queue
Messages 0, 2 dequeued
% twt dequeue               # deletes all the queued messages
Message queue is now empty

When you go back online, you can then deliver all the queued messages with the command:

% twt deliver
Delivering 3 queued messages:
message 0... Succesfully posted "test1"
sent
message 1... Succesfully posted "test2"
sent
message 2... Succesfully posted "test3"
sent
Message queue is now empty

NEW in ver. 0.3! Direct messages (DMs) are supported. To send a direct message to @user, just type:

% twt dm @user "message test"

In order to read the list of your direct messages, just issue:

% twt dms

Monitor your followers

If you want to monitor your followers and discover the name of the last ugly people that left your list, use the delta command:

% twt delta

This is new since version 0.1.5.

Follower management

You can add one or more users by means of the following command:

% twt follow oneuser anotheruser

In the same way, to stop following a given user is a matter of:

% twt unfollow annoyinguser

Reset the environment

twt keeps a few configuration variables (those marked as "sticky" in the short help) beside to the login in a hidden configuration file. If you want to reset to default values (and clean login information too), issue:

% twt reset

Options

At the moment, the following options are supported:

  • -cN: limits ANY subsequent query to N results (i.e. tweets). If you set the number to 0 (zero) you only get the new messages since your last query (sticky)
  • -wN: format messages to be nicely represented in a console of width N (sticky)
  • -r: prints out results in raw format (useful for debug or Twitter API inspection)
  • -s: toggles the insertion of an empty line between each result (sticky)
  • -p: toggles between compact and readable view for tweet heading (sticky)
  • -kCOLOR: sets the color for tweet user name (sticky)

Valid color codes are:

  • off => Turn off all attributes
  • bright => Set bright mode
  • underline => Set underline mode
  • blink => Set blink mode
  • inverse => Exchange foreground and background colors
  • hide => Hide text (foreground color would be the same as background)
  • black => Black text
  • red => Red text
  • green => Green text
  • yellow => Yellow text
  • blue => Blue text
  • magenta => Magenta text
  • cyan => Cyan text
  • white => White text
  • default => Default text color

Example: this will read the latest 10 tweets from your friends, and this limit of ten messages will remain valid for every subsequent call, until modified or until a reset:

% twt -c10 friends

To Dos

  • Support more commands (eg search).
  • Implement the daemon command together with the -t/--time, that will spawn a process that periodically checks for new tweets every given seconds. This will save a PID file on the ~/.twitter dir, that will be used to shut down that daemon (command name?).
  • Accept suggestions.

twt's People

Contributors

pbosetti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

amacy

twt's Issues

Incompatible with M1 mac

sudo gem install twt
Password:
Fetching equalizer-0.0.11.gem
Fetching ffi-compiler-1.0.1.gem
Fetching oauth-0.5.8.gem
Fetching buftok-0.2.0.gem
Fetching http-parser-1.2.3.gem
Fetching http-form_data-2.3.0.gem
Fetching unf_ext-0.0.8.1.gem
Fetching unf-0.1.4.gem
Fetching domain_name-0.5.20190701.gem
Fetching http-cookie-1.0.4.gem
Fetching http-4.4.1.gem
Fetching http_parser.rb-0.6.0.gem
Fetching memoizable-0.4.2.gem
Fetching multipart-post-2.1.1.gem
Fetching naught-1.1.0.gem
Fetching simple_oauth-0.3.1.gem
Fetching twitter-7.0.0.gem
Fetching twt-0.3.4.gem
Successfully installed oauth-0.5.8
Successfully installed buftok-0.2.0
Successfully installed equalizer-0.0.11
Successfully installed ffi-compiler-1.0.1
Building native extensions. This could take a while...
ERROR:  Error installing twt:
	ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/http-parser-1.2.3/ext
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -rrubygems /Library/Ruby/Gems/2.6.0/gems/rake-12.3.2/exe/rake RUBYARCHDIR\=/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/http-parser-1.2.3 RUBYLIBDIR\=/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/http-parser-1.2.3
rake aborted!
LoadError: dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle, 0x0009): missing compatible arch in /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/lib/ffi.rb:6:in `rescue in <top (required)>'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/lib/ffi.rb:3:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/ffi-compiler-1.0.1/lib/ffi-compiler/compile_task.rb:4:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/http-parser-1.2.3/ext/Rakefile:1:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/rake-12.3.2/exe/rake:27:in `<main>'

Caused by:
LoadError: cannot load such file -- 2.6/ffi_c
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/lib/ffi.rb:4:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/ffi-compiler-1.0.1/lib/ffi-compiler/compile_task.rb:4:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/http-parser-1.2.3/ext/Rakefile:1:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/rake-12.3.2/exe/rake:27:in `<main>'

Caused by:
LoadError: cannot load such file -- ffi-compiler/compile_task
/Library/Ruby/Gems/2.6.0/gems/http-parser-1.2.3/ext/Rakefile:1:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/rake-12.3.2/exe/rake:27:in `<main>'
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/http-parser-1.2.3 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/http-parser-1.2.3/gem_make.out

Please do let me know if any additional info would be helpful :)

oauth errors?

on a couple of systems (os x, centos), i'm seeing this on connection:

twt:119:in connect': undefined methodnew' for Twitter::Authentication:Module (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/twt-0.2.7/bin/twt:172:in query' from /Library/Ruby/Gems/1.8/gems/twt-0.2.7/bin/twt:391 from /usr/bin/twt:19:inload'
from /usr/bin/twt:19

i have these gem versions installed on os x:

twitter (1.6.2, 1.4.1)
twitter_oauth (0.4.3)
twt (0.2.7)

plus:

rubygems (1.8.2)
ruby (1.8.7, p174)

i'm guessing twitter oauth changes renamed or removed methods. is that the case?

Errors with twt on Snow Leopard / zsh

[10:15][christophe@lienragcuqorg] /Users/christophe -%> twt user
SHOWING LAST UNREAD USER_TIMELINE MESSAGES:
/Library/Ruby/Gems/1.8/gems/twt-0.2.1/bin/twt:60:in color': Wrong text color friends (ArgumentError) from /Library/Ruby/Gems/1.8/gems/twt-0.2.1/bin/twt:192:inquery'
from /Library/Ruby/Gems/1.8/gems/twt-0.2.1/bin/twt:180:in each' from /Library/Ruby/Gems/1.8/gems/twt-0.2.1/bin/twt:180:inquery'
from /Library/Ruby/Gems/1.8/gems/twt-0.2.1/bin/twt:345
from /usr/bin/twt:19:in load' from /usr/bin/twt:19 [14:30][christophe@lienragcuqorg] /Users/christophe -%> twt friends SHOWING LAST UNREAD FRIENDS_TIMELINE MESSAGES: /Library/Ruby/Gems/1.8/gems/twt-0.2.1/bin/twt:60:incolor': Wrong text color friends (ArgumentError)
from /Library/Ruby/Gems/1.8/gems/twt-0.2.1/bin/twt:192:in query' from /Library/Ruby/Gems/1.8/gems/twt-0.2.1/bin/twt:180:ineach'
from /Library/Ruby/Gems/1.8/gems/twt-0.2.1/bin/twt:180:in query' from /Library/Ruby/Gems/1.8/gems/twt-0.2.1/bin/twt:347 from /usr/bin/twt:19:inload'
from /usr/bin/twt:19
[14:31][christophe@lienragcuqorg] /Users/christophe -%> twt delta
Last time followers: 70
Now you have 72 follower(s)
New followers (2):
@Mat_A: Mathieu Arnold
@atchikservices: atchikservices
Lost followers (0):
none
[14:31][christophe@lienragcuqorg] /Users/christophe -%>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.