aesophor / py-todo Goto Github PK
View Code? Open in Web Editor NEWπ Lightweight reminder / todo-list in cli
Home Page: https://www.reddit.com/r/unixporn/comments/9qy35q/oc_pytodo_a_lightweight_reminder_in_cli/
License: MIT License
π Lightweight reminder / todo-list in cli
Home Page: https://www.reddit.com/r/unixporn/comments/9qy35q/oc_pytodo_a_lightweight_reminder_in_cli/
License: MIT License
and I'm cute π
I received a SyntaxError report from a user (related to f-string)
gcg@gcg:~/Documents/LaTex/CV1/tech inf ecole$ todo
File "/usr/bin/todo", line 69
output_str += f"{'This' if weeks_left == 0 else 'Next'} {self.exp_date.strftime('%A')}; "
^
SyntaxError: invalid syntax
gcg@gcg:~/Documents/LaTex/CV1/tech inf ecole$ python --version
Python 3.6.7
My test result:
Maybe it's because the user's /usr/bin/env python3
is invoking python3.5 somehow?
I think it would be better if we replace f-string with old formatting syntax, so that users that has python < 3.6 can also use py-todo.
I am not sure if the issue is in py-todo or in fish-prompt-metro. Also this is the fish-prompt-metro repo: https://github.com/fishpkg/fish-prompt-metro.
The issue:
~ > todo -a
Title: throw a party
Expiry date (YYYY/MM/DD or <days>d) (Optional): 2
An error occurred while parsing your date.
humanize_duration: nu s-a gΔsit comanda
~/.config/fish/functions/fish_right_prompt.fish (line 1):
echo $CMD_DURATION | humanize_duration
^
in command substitution
called on line 28 of file ~/.config/fish/functions/fish_right_prompt.fish
in function 'fish_right_prompt'
in command substitution
~/.config/fish/functions/fish_right_prompt.fish: Unknown error while evaluating command substitution
in function 'fish_right_prompt'
in command substitution
~ >
The contents of ~/.config/fish/functions/fish_right_prompt.fish
are:
function fish_right_prompt
set -l status_copy $status
set -l status_code $status_copy
set -l status_color 555
set -l status_glyph
set -l duration_glyph
switch "$status_copy"
case 0 "$__metro_status_last"
set status_code
end
set -g __metro_status_last $status_copy
if test "$status_copy" -eq 0
set duration_glyph " "
else
set status_color red
set status_glyph β
end
if test "$CMD_DURATION" -gt 250
if test ! -z "$status_code"
echo -sn (set_color $status_color) "($status_code)" (set_color normal)
set status_glyph β
end
set -l duration (echo $CMD_DURATION | humanize_duration)
echo -sn (set_color $status_color) " ($duration) $duration_glyph" (set_color normal)
else
if test ! -z "$status_code"
echo -sn (set_color $status_color) "$status_code " (set_color normal)
set status_glyph β
end
end
echo -sn (set_color $status_color) "$status_glyph" (set_color normal)
end
The output of fisher ls
is:
~ > fisher ls (3s 269ms)
fishpkg/fish-prompt-metro
franciscolourenco/done
jethrokuan/fzf
jorgebucaran/fish-nvm
joseluisq/gitnow
Thank you.
I have a problem reading the config file. An empty config files works fine, but then I am missing sweet colors and details. OS: macOS 10.14.4, py-todo: latest version per 20th of April, 2019.
Error message:
β― todo
Traceback (most recent call last):
File "/usr/local/bin/todo", line 289, in <module>
config.read(os.path.join(config_location, config_name))
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 696, in read
self._read(fp, filename)
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 1079, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: '/Users/max/.config/py-todo/config', line: 1
'color = true\n'
Contents of config
:
β― cat ~/.config/py-todo/config
color = true
detail_mode = true
I made an Ubuntu/Debian installer for this. It's here on my dropbox for now, although you should add it in the releases page (Rehost it somewhere else, don't post my dropbox link). I made the version of the deb 1.3.2 because it packages with the latest commit, 8083c03. It installs the todo script to /usr/local/bin/todo
. It does not create the config file by default, but it will attempt to remove ~/.config/py-todo
and the ~/.local/share/py-todo
if the package is removed with apt remove py-todo --purge
. It's really hard to get a package into the official Debian repositories, so I'm not even going to try; however, this still makes the install much easier for people who are new to Linux and don't want to manually install.
Note: this deb file assumes that you have /usr/local/bin
on your PATH
variable.
If you take a look at my not-yet-PR'd branch handlerRefactor, you'll see the general idea for what I'm thinking. The long if statement we have now is not very pretty or easy to read. I think it would be a good idea to move all that functionality from the if statements into functions. As you can see from my branch, each function is then registered into a dictionary. They key in the dict is a tuple of command line arguments that trigger the given function, which is stored as the value in the dict.
It might even be a good idea to put the handler functions in another file in the future. I did some research and it's possible to bundle multiple python files into a single executable zip file, so you won't need to install multiple files, just zip them all together.
Sorry I'm not a programer but I fell in love with the program and I'm thinking is any possibilities to add it to polybar?
Thanks a lot and thanks for the program!
Something that would be pretty cool to use with this program would be sorting the todos by closest date due / furthest date.
For example, todo -r 3 4 5
Hi!
I downloaded de latest version in github, manually, and when I enabled color = true in config file I encounter the next error:
Traceback (most recent call last): File "/home/jolupa/.local/bin/todo", line 167, in <module> list_items() File "/home/jolupa/.local/bin/todo", line 94, in list_items date = '(' + item.__str__().split('(')[1]
If I disable the color entry in the config file the problem disappears.
Thanks
As of 1.3 the current values (Title, Date) are not used as default, when editing items. This means that one has to rewrite the name, to edit the deadline and vice versa. This is trivial for short items, but cumbersome for longer titled items.
One solution could be to let current values be the default, and show them in parentheses when prompting, so that pressing enter when prompted for either, that value is kept.
An editing scenario with index 1 item named "Linear Algebra Test, Pages 12-666, Bldg 13 Room 101" would look like:
$ todo -e 1
Title (Linear Algebra Test, Pages 12-666, Bldg 13 Room 101): |
Instead of the current:
$ todo -e 1
Title: |
So that simply pressing enter keeps the current title, whereas it currently changes the item to have an empty title.
Could you add a license file? I am writing a package for the AUR and it is frowned upon to not have a license.
@aesophor I assume because you added an org-mode feature, that you use emacs or have some use for parsing org-mode TODO files. Can you post an example one that I can use for testing changes I made that pertain to org-mode? I don't use emacs, but that won't stop me from improving code π
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.