Adding "--status" option to the timeline #62

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
4 participants

vvgomes commented Aug 1, 2012

Hi,

I like to use the default timeline display. However, sometimes I want to know the status id for an specific tweet to be able to easily retweet, reply, get its details, or favorite without stopping streaming.

With that in mind, I've added the --status option to the timeline command, so that when I run t timeline -s or t stream timeline -s I get a timeline like this:

  @frankmt 230634608553783296
  RT @BarryOReilly: If your serious about continuous improvement you need to read "The
  Retrospective Handbook" by @patkua http://t.co/28930cNp #retrohandbook

  @dwildt 230635200672051200
  RT @marceloneves: Business analysis is not about requirements. It's about solutions.

  @trabalhosujo 230635254300418049
  David Gilmour http://t.co/42DkZzeQ

That has been very useful for me. I think more people might find it useful as well. It doesn't change any of the existing behavior, it just adds one more display option.

By the way, I've added spec examples for the new option. All specs are passing. It should go through Travis nicely.

Thanks!

Owner

sferik commented Aug 1, 2012

Is there a particular reason you prefer this approach to the --long option? You could use --long in conjunction with sed, awk, or cut to produce almost identical output. This is one of the features of using a command-line utility. To me, this is more in line with the Unix philosophy than adding a separate flag for every conceivable output format.

For example, this isn't identical to the output you've generated but it may solve your problem without adding any more complexity to t:

t timeline -l | cut -d ' ' -f1,8,11-

vvgomes commented Aug 2, 2012

Got it, sounds perfectly reasonable that the tool follows the unix philosophy and users should use its output as they like. However, the stream command doesn't give you any explicit output to be piped (as long as you don't kill it), so I couldn't find an easier/unixier way to accomplish what I wanted.

For instance, the following command line will print out exactly the same as the default displays plus the statuses:

t timeline -l | ruby -ne 'r=gets.match(/(\d{18})\s+\w{3}\s+\d+\s+\d+:\d+\s+(@\w+)\s+(.+)$/);puts" \e[1m\e[33m#{r[2]} \e[0m\e[33m#{r[1]}\n \e[0;37m#{r[3]}\n\n"'

Therefore, It doesn't show anything if you change the first part of the command to t stream timeline -l.

Any thoughts? Am I missing anything?

By the way, feel free close the pull request. I'll keep that in my fork.

Thanks!

Contributor

timvdalen commented Aug 3, 2012

However, the stream command doesn't give you any explicit output to be piped (as long as you don't kill it)

I might be able to help you with that. Take a look at this commit:

timvdalen/t@e7802e5

I didn't make a pull request because it's only one line, but that's all that you need to get stream to flush the output buffer for every line.

Owner

sferik commented Aug 14, 2012

@timvdalen Would you mind submitting a pull request that works with the latest version of the gem?

Contributor

timvdalen commented Aug 14, 2012

I just did. I merged your commits back into my branch first, so it should apply without any conflicts.

Owner

sferik commented Aug 14, 2012

@timvdalen I think you might need to make some changes to your code for it to work with the latest version. See my comments in #64.

I need exactly what @vvgomes is talking about .. a BIG +1 to @sferik for creating 't' and standing by the unix philosophy.. if I can use unix utils with 't' so that tweet ids appear in the continuous 'stream' as well, nothing like it.. but I am not sure how to get this done.. @timvdalen 's changes do not seem to have made it to this code base.. I have 't' installed using gem install t and pipeing anything with 'stream' is not working for me :( I am new to rails and have not really used github (could change soon).. any help would be appreciated.. thanks..

Contributor

timvdalen commented Jan 6, 2013

The reason my changes haven't made it to this code base is very simple: I have been busy and haven't had time to test against the master.

@timvdalen eh.. quick note (or links) on how I can do the testing of your changes against the latest master..?

Contributor

timvdalen commented Jan 7, 2013

I just pulled in the master at https://github.com/timvdalen/t The build passed so it should work but I'm not sure whether it will really do what it did with the new code or not.

@sferik sferik closed this Nov 19, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment