package com.tmitim.twittercli.commands;

import com.github.rvesse.airline.annotations.Command;
import com.github.rvesse.airline.annotations.Option;
import com.tmitim.twittercli.TimeLiner;
import com.tmitim.twittercli.pojos.TimeLine;

import twitter4j.TwitterFactory;

/**
 * Get timeline
 */
@Command(name = "timeline", description = "Get your timeline")
public class TimeLineCommand implements Runnable {

	@Option(name = { "-u", "--user" }, description = "get the timeline for a specific username")
	private String username;

	@Option(name = { "-a", "--all" }, description = "get all tweets (defaults is only new tweets)")
	private boolean allStatuses;

	@Option(name = { "-c", "--clear" }, description = "clear last checked time")
	private boolean clearLast;

	@Override
	public void run() {

		TimeLiner tl = new TimeLiner(
				new TimeLine(TwitterFactory.getSingleton()).setAllStatuses(allStatuses).setUsername(username));

		tl.pullStatuses();

		if (username == null) {
			tl.updateLastCheck();
		}

		if (clearLast) {
			tl.clearLastCheck();
		}

		tl.printStatuses();
	}
}
@@ -724,16 +724,40 @@
 ked time
+ before pulling timeline
 %22)%0A%09priv
@@ -946,16 +946,64 @@
 ame));%0A%0A
+%09%09if (clearLast) %7B%0A%09%09%09tl.clearLastCheck();%0A%09%09%7D%0A%0A
 %09%09tl.pul
@@ -1076,56 +1076,8 @@
 %09%7D%0A%0A
-%09%09if (clearLast) %7B%0A%09%09%09tl.clearLastCheck();%0A%09%09%7D%0A%0A
 %09%09tl

Move timeline check before t pull