Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- CLR_BLACK = "\e[1;30m" #Black
- CLR_RED = "\e[1;31m" #Red
- CLR_GREEN = "\e[1;32m" #Green
- CLR_YELLOW = "\e[1;33m" #Yellow
- CLR_BLUE = "\e[1;34m" #Blue
- CLR_MAGENTA = "\e[1;35m" #Magenta
- CLR_CYAN = "\e[1;36m" #Cyan
- CLR_WHITE = "\e[1;37m" #White
- CLR_DEFAULT = ""
- CLR_CLEAR = "\e[0m";
- DONE_TAG = "@done"
- TODO_TO_USE = "todo.taskpaper"
- def outtext (txt,clr)
- if (clr == "") then
- puts txt
- else
- puts clr+txt+CLR_CLEAR
- end
- end
- def list_tag (tagtitle,tagname,clr,clrtitle,showall)
- project = "???"
- titleshown = false
- File.open(TODO_TO_USE, "r") do |infile|
- while (line = infile.gets)
- line = line.gsub(/- /,"")
- # if it is project name line take project name
- if (/#*:/.match line) then
- project = line
- end
- # if done then skip
- if (line.include? DONE_TAG) then
- next
- end
- # if tag matches
- if (line.include? tagname) then
- if not titleshown then
- if not (tagtitle=="") then
- outtext(tagtitle,clrtitle)
- puts ""
- titleshown = true
- end
- end
- if (showall == true) then
- if (line.include? "@urgent") then
- outtext(" "+project.strip+" "+line.strip,CLR_RED)
- else
- outtext(" "+project.strip+" "+line.strip,clr)
- end
- else
- outtext("*** "+project.strip.upcase+" "+line.strip.gsub(/ @now/,"").upcase+" *** ","")
- exit
- end
- end
- end
- infile.close
- end
- if titleshown then
- puts ""
- end
- end
- if (ARGV.length == 0) then
- list_tag("@NOW","@now",CLR_YELLOW,CLR_WHITE,true)
- list_tag("@TODAY","@today",CLR_DEFAULT,CLR_WHITE,true)
- list_tag("@SOON","@soon",CLR_BLACK,CLR_WHITE,true)
- list_tag("@LATER","@later",CLR_BLACK,CLR_WHITE,true)
- list_tag("@FOLLOWUP","@followup",CLR_BLACK,CLR_BLACK,true)
- exit
- end
- list_tag("","@now","","",false)
- outtext("*** NOTHING TO DO? *** ","")
Advertisement
Add Comment
Please, Sign In to add comment