todotxt / todo.txt-cli

☑️ A simple and extensible shell script for managing your todo.txt file.
http://todotxt.org
GNU General Public License v3.0
5.55k stars 712 forks source link

Feature Wanted: colorized style continues to the end of the line #397

Closed mffan0922 closed 1 year ago

mffan0922 commented 1 year ago

Do you want to request a feature or report a bug? feature

What is the current behavior? plz see the screenshot as below:

Snipaste_2022-11-29_21-32-29

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

  1. add some todos using tt add ...
  2. set pri to some of them
  3. executing tt ls will see the priority ones will be colorized, but not to the end of their line correspondingly

What is the expected behavior? I hope the priority lines would be colorized to then end of its line. AND I tried to modify the source code and find the code as below, but failed, so could you help to add this feature to this useful tool? image

Which versions todo.sh are you using?

Run todo.sh -V TODO.TXT Command Line Interface v2.12.0

Which Operating System are you using? Debian 11.5

Which version of bash are you using?

Run bash --version GNU bash, version 5.1.4(1)-release (x86_64-pc-linux-gnu)

inkarkat commented 1 year ago

I think the only way this can be done is through adding spaces at the end of each task to fill up the terminal width. As long as you can assume that each character is one screen cell wide this is easy, but hard considering double-width characters, tabs, emojis.

You seem to be using an unorthodox format with a custom timestamp, and |-aligned columns for projects and scheduling. If you have that formatting inside the todo file itself, that would go aginst the simplicity spirit of todo.txt; but if you use a custom filter to add the formatting to the tasks, you could easily implement the full line coloring there (and it would have to be less generic as you know what kind of characters you personally use).

mffan0922 commented 1 year ago

tt a "@${tdate --date='string'} | +project | T:TBD | something to do......."

alias tdate='date +%Y-%m-%dT%H:%M:%S'

yes, I use a python script & inotify tools to process todo.txt. Whenever the file is opened or modified, the python script will be executed, and tt lswill supply a pretty format. I think it's better to be done by shell scripts.

OK, I will try to impement this using python scripts, thx anyway.