Loading ...
Sorry, an error occurred while loading the content.

Color highlighting filter

Expand Messages
  • Mark Harrison
    Hi all, I wanted to make todo.sh a little more colorful, hilighting contexts, projects and dates, so I made a TODOTXT_FINAL_FILTER that does this. Right now
    Message 1 of 6 , Jun 20, 2009
    View Source
    • 0 Attachment
      Hi all,

      I wanted to make todo.sh a little more colorful, hilighting contexts, projects and dates, so I made a TODOTXT_FINAL_FILTER that does this. Right now it's just a copy/paste into your todo.cfg file and change as needed, but I'd like to know if there's a right/better way to do this (e.g. putting it in a separate script). I've also tried to make it work correctly with priority colors also, only hilighting any dates/contexts/projects and restoring the priority color afterward.

      I posted the filter as a gist at http://gist.github.com/133375 .

      Mark
    • Frederik Dohr
      ... That s nice - thanks for sharing! While I got an error awk: not an option: --posix (on Ubuntu Intrepid), removing that argument seemed to do the trick.
      Message 2 of 6 , Jun 21, 2009
      View Source
      • 0 Attachment
        > I wanted to make todo.sh a little more colorful, hilighting contexts,
        > projects and dates, so I made a TODOTXT_FINAL_FILTER that does this.

        That's nice - thanks for sharing!

        While I got an error "awk: not an option: --posix" (on Ubuntu Intrepid),
        removing that argument seemed to do the trick.

        > Right now it's just a copy/paste into your todo.cfg file and change as
        > needed, but I'd like to know if there's a right/better way to do this

        You should be able to reference a executable script file there.
        For example, I'm using my futureTasks* script in my .todo.cfg:
        export TODOTXT_FINAL_FILTER="~/.todo.actions.d/futureTasks"

        (I don't think this is properly documented on the wiki yet.)

        HTH.


        -- F.


        * http://github.com/FND/todo.txt-cli/blob/extensions/futureTasks
      • Mark Harrison
        Hi Frederik, Thank you for your feedback. While I got an error awk: not an option: --posix (on Ubuntu Intrepid), ... The --posix option is only required if
        Message 3 of 6 , Jun 21, 2009
        View Source
        • 0 Attachment
          Hi Frederik,

          Thank you for your feedback.

          While I got an error "awk: not an option: --posix" (on Ubuntu Intrepid),
          removing that argument seemed to do the trick.

          The --posix option is only required if you want to hilight the dates. For some reason GNU awk without any options doesn't support the {n} expression to match a regex exactly n times. I've changed the gist to be a separate script, and changed the --posix option to be "-W posix", which should work with mawk (I'm guessing this is what your awk version is). The -W option still doesn't seem to work on some versions of awk however (I tried on solaris, and got a complaint), and I'm unsure of a good way to force gawk to behave correctly while remaining compatible.

          You should be able to reference a executable script file there.
          For example, I'm using my futureTasks* script in my .todo.cfg:
              export TODOTXT_FINAL_FILTER="~/.todo.actions.d/futureTasks"

          This would also have the effect of creating a new command futureTasks, which wouldn't actually do anything, but it seems to be there should be a better place to put filters. I wonder if something like ~/.todo.filters.d would be a good place, or perhaps arranging everything under a .todo/ directory?

          Mark

        • Frederik Dohr
          ... Thanks, that works nicely on my machine now. (Not sure about options to solve the compatibility issue, I m afraid.) ... I d very much welcome that - also
          Message 4 of 6 , Jun 21, 2009
          View Source
          • 0 Attachment
            > I've changed the gist to be a separate script, and changed the
            > the --posix option to be "-W posix", which should work with mawk

            Thanks, that works nicely on my machine now.
            (Not sure about options to solve the compatibility issue, I'm afraid.)

            > This would also have the effect of creating a new command [...]
            > it seems to be there should be a better place to put filters. I wonder
            > if something like ~/.todo.filters.d would be a good place, or perhaps
            > arranging everything under a .todo/ directory?

            I'd very much welcome that - also see this ticket:
            http://github.com/ginatrapani/todo.txt-cli/issues#issue/9


            -- F.
          • Mark Harrison
            ... I moved the options to a variable for now, and it can just be commented out where it doesn t work. ... Ah, I didn t realize it was you who first suggested
            Message 5 of 6 , Jun 21, 2009
            View Source
            • 0 Attachment
              Thanks, that works nicely on my machine now.
              (Not sure about options to solve the compatibility issue, I'm afraid.)
               
              I moved the options to a variable for now, and it can just be commented out where it doesn't work.
               
              I'd very much welcome that - also see this ticket:
                  http://github.com/ginatrapani/todo.txt-cli/issues#issue/9

              Ah, I didn't realize it was you who first suggested the .todo dir. That layout looks perfect, and it seems like it would be achievable without requiring the code to be changed (it would be nice to have that layout be the default however). See my comment on how to do this if you haven't done it already:  http://github.com/ginatrapani/todo.txt-cli/issues/#issue/9/comment/19744
            • Mark Harrison
              I m not sure if you downloaded the right version or not, but I realized that the colorFilter script failed when you use -p (turn off colors). The latest
              Message 6 of 6 , Jun 23, 2009
              View Source
              • 0 Attachment
                I'm not sure if you downloaded the right version or not, but I realized that the colorFilter script failed when you use -p (turn off colors). The latest version of the gist fixes this by changing the 'filter' to cat if you have colors turned off.

                Thanks, that works nicely on my machine now.
                (Not sure about options to solve the compatibility issue, I'm afraid.)

              Your message has been successfully submitted and would be delivered to recipients shortly.