GithubHelp home page GithubHelp logo

aesophor / py-todo Goto Github PK

View Code? Open in Web Editor NEW
107.0 107.0 22.0 153 KB

πŸ“‹ 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

Python 100.00%
cli python todo todolist

py-todo's People

Contributors

25077667 avatar aesophor avatar arskiy avatar christophergeiger3 avatar cycatz avatar jcstill avatar johntitor avatar jonaylor89 avatar louisklimek avatar luvhalvorson avatar mmarinov97 avatar patatman avatar rewoundvhs avatar steampunkery avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

py-todo's Issues

Replace f-string with old formatting syntax?

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:

  • 3.5.5 -> SyntaxError
  • >= 3.6 -> OK

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.

Compatibility with fish shell and fish-prompt-metro

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.

config file read error

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

Ubuntu/Debian Installer

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.

Moving argument handling from if statements to functions

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.

Add Polybar script?

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!

Add Sorting Functionality

Something that would be pretty cool to use with this program would be sorting the todos by closest date due / furthest date.

Problem with color=true in config file

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

Let current values be default when editing items.

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.

Add License

Could you add a license file? I am writing a package for the AUR and it is frowned upon to not have a license.

Org-mode TODO test file

@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 πŸ˜ƒ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.